class Gammo::Parser::AfterBody

Section 12.2.6.4.19.

Public Instance Methods

comment_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/after_body.rb, line 31
def comment_token(token)
  open_elements = parser.open_elements
  if open_elements.length < 1 || open_elements.first.tag != Tags::Html
    raise ParseError, 'bad parser state: <html> element not found, in the after-body insertion mode'
  end
  open_elements.first.append_child Node::Comment.new(data: token.data)
  halt true
end
default(_) click to toggle source
# File lib/gammo/parser/insertion_mode/after_body.rb, line 40
def default(_)
  parser.insertion_mode = InBody
  halt false
end
end_tag_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/after_body.rb, line 23
def end_tag_token(token)
  case token.tag
  when Tags::Html
    parser.insertion_mode = AfterAfterBody unless parser.fragment?
    halt true
  end
end
error_token(_) click to toggle source
# File lib/gammo/parser/insertion_mode/after_body.rb, line 6
def error_token(_)
  # ignore the token
  true
end
start_tag_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/after_body.rb, line 16
def start_tag_token(token)
  case token.tag
  when Tags::Html
    halt InBody.new(parser).process
  end
end
text_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/after_body.rb, line 11
def text_token(token)
  s = token.data.lstrip
  halt InBody.new(parser).process if s.length.zero?
end