2007-07-05 00:36:59 +02:00
|
|
|
require 'html5/html5parser/phase'
|
2007-05-30 17:45:52 +02:00
|
|
|
|
2007-07-05 00:36:59 +02:00
|
|
|
module HTML5
|
2007-05-30 17:45:52 +02:00
|
|
|
class AfterBodyPhase < Phase
|
|
|
|
|
|
|
|
handle_end 'html'
|
|
|
|
|
|
|
|
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.insertComment(data, @tree.openElements[0])
|
|
|
|
end
|
|
|
|
|
|
|
|
def processCharacters(data)
|
|
|
|
@parser.parseError(_('Unexpected non-space characters in the after body phase.'))
|
|
|
|
@parser.phase = @parser.phases[:inBody]
|
|
|
|
@parser.phase.processCharacters(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def processStartTag(name, attributes)
|
|
|
|
@parser.parseError(_("Unexpected start tag token (#{name}) in the after body phase."))
|
|
|
|
@parser.phase = @parser.phases[:inBody]
|
|
|
|
@parser.phase.processStartTag(name, attributes)
|
|
|
|
end
|
|
|
|
|
|
|
|
def endTagHtml(name)
|
|
|
|
if @parser.innerHTML
|
|
|
|
@parser.parseError
|
|
|
|
else
|
|
|
|
# XXX: This may need to be done, not sure
|
|
|
|
# Don't set lastPhase 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.lastPhase = @parser.phase
|
|
|
|
@parser.phase = @parser.phases[:trailingEnd]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def endTagOther(name)
|
|
|
|
@parser.parseError(_("Unexpected end tag token (#{name}) in the after body phase."))
|
|
|
|
@parser.phase = @parser.phases[:inBody]
|
|
|
|
@parser.phase.processEndTag(name)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|