Class: HTML5::AfterBodyPhase

Inherits:
Phase
  • Object
show all
Defined in:
lib/html5/html5parser/after_body_phase.rb

Instance Method Summary collapse

Methods inherited from Phase

#adjust_foreign_attributes, #adjust_mathml_attributes, #assert, end_tag_handlers, handle_end, handle_start, #in_scope?, #initialize, #processDoctype, #processEndTag, #processSpaceCharacters, #process_eof, #remove_open_elements_until, #startTagHtml, start_tag_handlers, tag_handlers

Constructor Details

This class inherits a constructor from HTML5::Phase

Instance Method Details

#endTagHtml(name) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/html5/html5parser/after_body_phase.rb', line 26

def endTagHtml(name)
  if @parser.inner_html
    parse_error "end-html-in-innerhtml"
  else
    # XXX: This may need to be done, not sure
    # Don't set last_phase to the current phase but to the inBody phase
    # instead. No need for extra parse errors if there's something after </html>.
    # Try "<!doctype html>X</html>X" for instance.
    @parser.last_phase = @parser.phase
    @parser.phase      = @parser.phases[:afterAfterBody]
  end
end

#endTagOther(name) ⇒ Object



39
40
41
42
43
# File 'lib/html5/html5parser/after_body_phase.rb', line 39

def endTagOther(name)
  parse_error("unexpected-end-tag-after-body", {"name" => name})
  @parser.phase = @parser.phases[:inBody]
  @parser.phase.processEndTag(name)
end

#processCharacters(data) ⇒ Object



14
15
16
17
18
# File 'lib/html5/html5parser/after_body_phase.rb', line 14

def processCharacters(data)
  parse_error("unexpected-char-after-body")
  @parser.phase = @parser.phases[:inBody]
  @parser.phase.processCharacters(data)
end

#processComment(data) ⇒ Object



8
9
10
11
12
# File 'lib/html5/html5parser/after_body_phase.rb', line 8

def processComment(data)
  # This is needed because data is to be appended to the <html> element
  # here and not to whatever is currently open.
  @tree.insert_comment(data, @tree.open_elements.first)
end

#processStartTag(name, attributes, self_closing = false) ⇒ Object



20
21
22
23
24
# File 'lib/html5/html5parser/after_body_phase.rb', line 20

def processStartTag(name, attributes, self_closing=false)
  parse_error("unexpected-start-tag-after-body", {"name" => name})
  @parser.phase = @parser.phases[:inBody]
  @parser.phase.processStartTag(name, attributes)
end