Class HTML5::InHeadPhase
In: lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb
Parent: Phase
Phase XmlElementPhase InTablePhase RootElementPhase InHeadPhase AfterHeadPhase AfterFramesetPhase XmlRootPhase InitialPhase InTableBodyPhase InFramesetPhase InColumnGroupPhase InCaptionPhase TrailingEndPhase InSelectPhase BeforeHeadPhase InCellPhase InBodyPhase AfterBodyPhase InRowPhase Exception SerializeError EOF AssertionError ParseError HTMLSanitizer HTMLTokenizer XhmlRootPhase XMLParser XHTMLParser HTMLParser String EncodingBytes HTMLSerializer XHTMLSerializer TreeWalkers::Base NonRecursiveTreeWalker TreeWalker TreeWalker Base TreeWalker Element DocumentFragment Node CommentNode DocumentType TextNode Document Base::Node Node Node Base::TreeBuilder TreeBuilder TreeBuilder TreeBuilder Element DocumentFragment CommentNode DocumentType TextNode Document Element DocumentFragment CommentNode DocumentType TextNode Document Enumerable TestData Base OptionalTagFilter InjectMetaCharset WhitespaceFilter HTMLSanitizeFilter HTMLSanitizeModule SimpleDelegator HTMLInputStream EncodingParser ContentAttrParser Node TreeBuilder lib/feed_tools/vendor/html5/lib/html5/html5parser/trailing_end_phase.rb lib/feed_tools/vendor/html5/lib/html5/constants.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/after_frameset_phase.rb lib/feed_tools/vendor/html5/lib/html5/liberalxmlparser.rb lib/feed_tools/vendor/html5/lib/html5/serializer/xhtmlserializer.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_caption_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_frameset_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/initial_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/root_element_phase.rb lib/feed_tools/vendor/html5/lib/html5/serializer/htmlserializer.rb lib/feed_tools/vendor/html5/lib/html5/tokenizer.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/before_head_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_select_phase.rb lib/feed_tools/vendor/html5/lib/html5/inputstream.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_row_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_cell_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_body_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/after_body_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/after_head_phase.rb lib/feed_tools/vendor/html5/lib/html5/sanitizer.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_column_group_phase.rb lib/feed_tools/vendor/html5/lib/html5/treewalkers/base.rb lib/feed_tools/vendor/html5/lib/html5/treewalkers/hpricot.rb Hpricot TokenConstructor lib/feed_tools/vendor/html5/lib/html5/treewalkers/rexml.rb REXML lib/feed_tools/vendor/html5/lib/html5/treewalkers/simpletree.rb SimpleTree TreeWalkers HTMLSanitizeModule lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb Hpricot lib/feed_tools/vendor/html5/lib/html5/treebuilders/rexml.rb REXML lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb Base lib/feed_tools/vendor/html5/lib/html5/treebuilders/simpletree.rb SimpleTree TreeBuilders lib/feed_tools/vendor/html5/tests/preamble.rb TestSupport Sniffer lib/feed_tools/vendor/html5/lib/html5/filters/whitespace.rb lib/feed_tools/vendor/html5/lib/html5/filters/optionaltags.rb lib/feed_tools/vendor/html5/lib/html5/filters/base.rb lib/feed_tools/vendor/html5/lib/html5/filters/inject_meta_charset.rb lib/feed_tools/vendor/html5/lib/html5/filters/sanitizer.rb Filters HTML5 dot/m_66_0.png

Methods

Public Instance methods

[Source]

     # 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

[Source]

    # 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

[Source]

     # 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

[Source]

     # 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

[Source]

     # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

Protected Instance methods

[Source]

     # 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

[Validate]