Class: HTML5::InTablePhase
- Inherits:
-
Phase
- Object
- Phase
- HTML5::InTablePhase
show all
- Defined in:
- lib/html5/html5parser/in_table_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, #processComment, #processDoctype, #processEndTag, #processStartTag, #remove_open_elements_until, #startTagHtml, start_tag_handlers, tag_handlers
Constructor Details
This class inherits a constructor from HTML5::Phase
Instance Method Details
#endStyleScript(name) ⇒ Object
150
151
152
153
154
155
156
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 150
def endStyleScript name
if !current_table().flags.include?("tainted")
@parser.phases[:inHead].processEndTag(name)
else
endTagOther(name)
end
end
|
#endTagIgnore(name) ⇒ Object
137
138
139
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 137
def endTagIgnore(name)
parse_error("unexpected-end-tag", {"name" => name})
end
|
#endTagOther(name) ⇒ Object
141
142
143
144
145
146
147
148
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 141
def endTagOther(name)
parse_error("unexpected-end-tag-implies-table-voodoo", {"name" => name})
@tree.insert_from_table = true
@parser.phases[:inBody].processEndTag(name)
@tree.insert_from_table = false
end
|
#endTagTable(name) ⇒ Object
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 117
def endTagTable(name)
if in_scope?('table', true)
@tree.generateImpliedEndTags
unless @tree.open_elements.last.name == 'table'
parse_error("end-tag-too-early-named",
{"gotName" => "table",
"expectedName" => @tree.open_elements.last.name})
end
remove_open_elements_until('table')
@parser.reset_insertion_mode
else
assert @parser.inner_html
parse_error "unexpected-end-tag", {:name => name}
end
end
|
#process_eof ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 41
def process_eof
if @tree.open_elements.last.name != "html"
@parser.parse_error("eof-in-table")
else
assert @parser.innerHTML
end
end
|
#processCharacters(data) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 26
def processCharacters(data)
if ["style", "script"].include?(@tree.open_elements.last.name)
@tree.insertText(data)
else
if !current_table.flags.include?("tainted")
@parser.parse_error("unexpected-char-implies-table-voodoo")
current_table.flags << "tainted"
end
@tree.insert_from_table = true
@parser.phases[:inBody].processCharacters(data)
@tree.insert_from_table = false
end
end
|
#processSpaceCharacters(data) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 18
def processSpaceCharacters(data)
if !current_table.flags.include?("tainted")
@tree.insertText(data)
else
processCharacters(data)
end
end
|
#startTagCaption(name, attributes) ⇒ Object
49
50
51
52
53
54
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 49
def startTagCaption(name, attributes)
clear_stack_to_table_context
@tree.activeFormattingElements.push(Marker)
@tree.insert_element(name, attributes)
@parser.phase = @parser.phases[:inCaption]
end
|
#startTagCol(name, attributes) ⇒ Object
62
63
64
65
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 62
def startTagCol(name, attributes)
startTagColgroup('colgroup', {})
@parser.phase.processStartTag(name, attributes)
end
|
#startTagColgroup(name, attributes) ⇒ Object
56
57
58
59
60
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 56
def startTagColgroup(name, attributes)
clear_stack_to_table_context
@tree.insert_element(name, attributes)
@parser.phase = @parser.phases[:inColumnGroup]
end
|
#startTagImplyTbody(name, attributes) ⇒ Object
73
74
75
76
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 73
def startTagImplyTbody(name, attributes)
startTagRowGroup('tbody', {})
@parser.phase.processStartTag(name, attributes)
end
|
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 104
def startTagInput(name, attributes)
if attributes.include?("type") &&
attributes["type"].downcase == "hidden" &&
!current_table.flags.include?("tainted")
@parser.parse_error("unpexted-hidden-input-in-table")
@tree.insert_element(name, attributes)
@tree.open_elements.pop
else
self.startTagOther(name, attributes)
end
end
|
#startTagOther(name, attributes) ⇒ Object
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 85
def startTagOther(name, attributes)
@parser.parse_error("unexpected-start-tag-implies-table-voodoo", {:name => name})
if !current_table.flags.include?("tainted")
current_table.flags.push("tainted")
end
@tree.insert_from_table = true
@parser.phases[:inBody].processStartTag(name, attributes)
@tree.insert_from_table = false
end
|
#startTagRowGroup(name, attributes) ⇒ Object
67
68
69
70
71
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 67
def startTagRowGroup(name, attributes)
clear_stack_to_table_context
@tree.insert_element(name, attributes)
@parser.phase = @parser.phases[:inTableBody]
end
|
96
97
98
99
100
101
102
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 96
def startTagStyleScript(name, attributes)
if !current_table.flags.include?("tainted")
@parser.phases[:inHead].processStartTag(name, attributes)
else
startTagOther(name, attributes)
end
end
|
#startTagTable(name, attributes) ⇒ Object
78
79
80
81
82
83
|
# File 'lib/html5/html5parser/in_table_phase.rb', line 78
def startTagTable(name, attributes)
parse_error("unexpected-start-tag-implies-end-tag",
{"startName" => "table", "endName" => "table"})
@parser.phase.processEndTag('table')
@parser.phase.processStartTag(name, attributes) unless @parser.inner_html
end
|