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 InColumnGroupPhase < Phase
|
|
|
|
|
|
|
|
# http://www.whatwg.org/specs/web-apps/current-work/#in-column
|
|
|
|
|
|
|
|
handle_start 'html', 'col'
|
|
|
|
|
|
|
|
handle_end 'colgroup', 'col'
|
|
|
|
|
|
|
|
def ignoreEndTagColgroup
|
2007-08-30 19:19:10 +02:00
|
|
|
@tree.open_elements[-1].name == 'html'
|
2007-05-30 17:45:52 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def processCharacters(data)
|
|
|
|
ignoreEndTag = ignoreEndTagColgroup
|
|
|
|
endTagColgroup("colgroup")
|
|
|
|
@parser.phase.processCharacters(data) unless ignoreEndTag
|
|
|
|
end
|
|
|
|
|
|
|
|
def startTagCol(name, attributes)
|
2007-08-30 19:19:10 +02:00
|
|
|
@tree.insert_element(name, attributes)
|
|
|
|
@tree.open_elements.pop
|
2007-05-30 17:45:52 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def startTagOther(name, attributes)
|
|
|
|
ignoreEndTag = ignoreEndTagColgroup
|
|
|
|
endTagColgroup('colgroup')
|
|
|
|
@parser.phase.processStartTag(name, attributes) unless ignoreEndTag
|
|
|
|
end
|
|
|
|
|
|
|
|
def endTagColgroup(name)
|
|
|
|
if ignoreEndTagColgroup
|
2007-08-30 19:19:10 +02:00
|
|
|
# inner_html case
|
|
|
|
assert @parser.inner_html
|
2007-10-28 00:34:29 +02:00
|
|
|
parse_error "unexpected-end-tag", {:name => name}
|
2007-05-30 17:45:52 +02:00
|
|
|
else
|
2007-08-30 19:19:10 +02:00
|
|
|
@tree.open_elements.pop
|
2007-05-30 17:45:52 +02:00
|
|
|
@parser.phase = @parser.phases[:inTable]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def endTagCol(name)
|
2007-09-10 05:26:19 +02:00
|
|
|
parse_error("no-end-tag", {"name" => "col"})
|
2007-05-30 17:45:52 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def endTagOther(name)
|
|
|
|
ignoreEndTag = ignoreEndTagColgroup
|
|
|
|
endTagColgroup('colgroup')
|
|
|
|
@parser.phase.processEndTag(name) unless ignoreEndTag
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|