| Class | HTML5::InHeadPhase |
| In: |
lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb
|
| Parent: | Phase |
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 118
118: def anything_else
119: if @tree.open_elements.last.name == 'head'
120: endTagHead('head')
121: else
122: @parser.phase = @parser.phases[:afterHead]
123: end
124: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 92
92: def endTagHead(name)
93: if @tree.open_elements.last.name == 'head'
94: @tree.open_elements.pop
95: else
96: parse_error("unexpected-end-tag", {"name" => "head"})
97: end
98: @parser.phase = @parser.phases[:afterHead]
99: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 101
101: def endTagImplyAfterHead(name)
102: anything_else
103: @parser.phase.processEndTag(name)
104: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 114
114: def endTagOther(name)
115: parse_error("unexpected-end-tag", {"name" => name})
116: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 106
106: def endTagTitleStyleScriptNoscript(name)
107: if @tree.open_elements.last.name == name
108: @tree.open_elements.pop
109: else
110: parse_error("unexpected-end-tag", {"name" => name})
111: end
112: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 22
22: def processCharacters(data)
23: if %w[title style script noscript].include?(@tree.open_elements.last.name)
24: @tree.insertText(data)
25: else
26: anything_else
27: @parser.phase.processCharacters(data)
28: end
29: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 13
13: def process_eof
14: if ['title', 'style', 'script'].include?(name = @tree.open_elements.last.name)
15: parse_error("expected-named-closing-tag-but-got-eof", {"name" => @tree.open_elements.last.name})
16: @tree.open_elements.pop
17: end
18: anything_else
19: @parser.phase.process_eof
20: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 78
78: def startTagBaseLinkMeta(name, attributes)
79: element = @tree.createElement(name, attributes)
80: if @tree.head_pointer != nil and @parser.phase == @parser.phases[:inHead]
81: appendToHead(element)
82: else
83: @tree.open_elements.last.appendChild(element)
84: end
85: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 31
31: def startTagHead(name, attributes)
32: parse_error("two-heads-are-not-better-than-one")
33: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 53
53: def startTagNoscript(name, attributes)
54: # XXX Need to decide whether to implement the scripting disabled case.
55: element = @tree.createElement(name, attributes)
56: if @tree.head_pointer !=nil and @parser.phase == @parser.phases[:inHead]
57: appendToHead(element)
58: else
59: @tree.open_elements.last.appendChild(element)
60: end
61: @tree.open_elements.push(element)
62: @parser.tokenizer.content_model_flag = :CDATA
63: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 87
87: def startTagOther(name, attributes)
88: anything_else
89: @parser.phase.processStartTag(name, attributes)
90: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 65
65: def startTagScript(name, attributes)
66: #XXX Inner HTML case may be wrong
67: element = @tree.createElement(name, attributes)
68: element._flags.push("parser-inserted")
69: if @tree.head_pointer != nil and @parser.phase == @parser.phases[:inHead]
70: appendToHead(element)
71: else
72: @tree.open_elements.last.appendChild(element)
73: end
74: @tree.open_elements.push(element)
75: @parser.tokenizer.content_model_flag = :CDATA
76: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 42
42: def startTagStyle(name, attributes)
43: element = @tree.createElement(name, attributes)
44: if @tree.head_pointer != nil and @parser.phase == @parser.phases[:inHead]
45: appendToHead(element)
46: else
47: @tree.open_elements.last.appendChild(element)
48: end
49: @tree.open_elements.push(element)
50: @parser.tokenizer.content_model_flag = :CDATA
51: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 35
35: def startTagTitle(name, attributes)
36: element = @tree.createElement(name, attributes)
37: appendToHead(element)
38: @tree.open_elements.push(element)
39: @parser.tokenizer.content_model_flag = :RCDATA
40: end
# File lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb, line 128
128: def appendToHead(element)
129: if @tree.head_pointer.nil?
130: assert @parser.inner_html
131: @tree.open_elements.last.appendChild(element)
132: else
133: @tree.head_pointer.appendChild(element)
134: end
135: end