1
use markup5ever :: {
2
expanded_name , local_name , namespace_prefix , namespace_url , ns
3
} ; use crate :: tokenizer :: states :: {
4
Plaintext , Rawtext , Rcdata , ScriptData
5
194667
} ; use crate :: tree_builder :: tag_sets :: * ; use crate :: tree_builder :: types :: * ; use std :: borrow :: ToOwned ; use crate :: tendril :: SliceExt ; fn any_not_whitespace (x : & StrTendril) -> bool {
6
242396
x . chars () . any (| c | ! c . is_ascii_whitespace ())
7
194667
} fn current_node < Handle > (open_elems : & [Handle]) -> & Handle {
8
open_elems . last () . expect ("no current element")
9
} # [doc (hidden)] impl < Handle , Sink > TreeBuilder < Handle , Sink > where Handle : Clone , Sink : TreeSink < Handle = Handle > , {
10
297097
fn step (& mut self , mode : InsertionMode , token : Token) -> ProcessResult < Handle > {
11
297097
self . debug_step (mode , & token) ; match mode {
12
Initial => match token {
13
14
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , _) => Done , CommentToken (text) => self . append_comment_to_doc (text) , last_arm_token => {
14
14
let enable_wildcards = match last_arm_token {
15
14
_ => true ,
16
14
} ; match (enable_wildcards , last_arm_token) {
17
14
(_ , token) => {
18
14
if ! self . opts . iframe_srcdoc {
19
14
self . unexpected (& token) ; self . set_quirks_mode (Quirks) ;
20
14
} Reprocess (BeforeHtml , token)
21
} ,
22
}
23
}
24
501
} , BeforeHtml => match token {
25
501
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , _) => Done , CommentToken (text) => self . append_comment_to_doc (text) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
26
501
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
27
501
}) => {
28
501
self . create_root (tag . attrs) ; self . mode = BeforeHead ; Done
29
14
} , last_arm_token => {
30
14
let enable_wildcards = match last_arm_token {
31
crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
32
kind : crate :: tokenizer :: EndTag , name : local_name ! ("head") , ..
33
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
34
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
35
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
36
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
37
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
38
kind : crate :: tokenizer :: EndTag , name : local_name ! ("br") , ..
39
14
}) => false , _ => true ,
40
14
} ; match (enable_wildcards , last_arm_token) {
41
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
42
kind : crate :: tokenizer :: EndTag , ..
43
14
})) => self . unexpected (& tag) , (_ , token) => {
44
14
self . create_root (vec ! ()) ; Reprocess (BeforeHead , token)
45
} ,
46
}
47
}
48
501
} , BeforeHead => match token {
49
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , _) => Done , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
50
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
51
501
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
52
501
kind : crate :: tokenizer :: StartTag , name : local_name ! ("head") , ..
53
501
}) => {
54
501
self . head_elem = Some (self . insert_element_for (tag)) ; self . mode = InHead ; Done
55
14
} , last_arm_token => {
56
14
let enable_wildcards = match last_arm_token {
57
crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
58
kind : crate :: tokenizer :: EndTag , name : local_name ! ("head") , ..
59
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
60
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
61
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
62
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
63
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
64
kind : crate :: tokenizer :: EndTag , name : local_name ! ("br") , ..
65
14
}) => false , _ => true ,
66
14
} ; match (enable_wildcards , last_arm_token) {
67
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
68
kind : crate :: tokenizer :: EndTag , ..
69
14
})) => self . unexpected (& tag) , (_ , token) => {
70
14
self . head_elem = Some (self . insert_phantom (local_name ! ("head"))) ; Reprocess (InHead , token)
71
} ,
72
}
73
}
74
14102
} , InHead => match token {
75
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , text) => self . append_text (text) , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
76
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
77
501
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
78
kind : crate :: tokenizer :: StartTag , name : local_name ! ("base") , ..
79
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
80
kind : crate :: tokenizer :: StartTag , name : local_name ! ("basefont") , ..
81
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
82
kind : crate :: tokenizer :: StartTag , name : local_name ! ("bgsound") , ..
83
1906
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
84
kind : crate :: tokenizer :: StartTag , name : local_name ! ("link") , ..
85
10623
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
86
kind : crate :: tokenizer :: StartTag , name : local_name ! ("meta") , ..
87
}) => {
88
13030
self . insert_and_pop_element_for (tag) ; DoneAckSelfClosing
89
501
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
90
501
kind : crate :: tokenizer :: StartTag , name : local_name ! ("title") , ..
91
501
}) => {
92
501
self . parse_raw_data (tag , Rcdata)
93
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
94
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noframes") , ..
95
70
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
96
kind : crate :: tokenizer :: StartTag , name : local_name ! ("style") , ..
97
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
98
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noscript") , ..
99
}) => {
100
70
if (! self . opts . scripting_enabled) && (tag . name == local_name ! ("noscript")) {
101
self . insert_element_for (tag) ; self . mode = InHeadNoscript ; Done
102
} else {
103
70
self . parse_raw_data (tag , Rawtext)
104
}
105
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
106
kind : crate :: tokenizer :: StartTag , name : local_name ! ("script") , ..
107
}) => {
108
let elem = create_element (& mut self . sink , QualName :: new (None , ns ! (html) , local_name ! ("script")) , tag . attrs) ; if self . is_fragment () {
109
self . sink . mark_script_already_started (& elem) ;
110
} self . insert_appropriately (AppendNode (elem . clone ()) , None) ; self . open_elems . push (elem) ; self . to_raw_text_mode (ScriptData)
111
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
112
kind : crate :: tokenizer :: EndTag , name : local_name ! ("head") , ..
113
}) => {
114
501
self . pop () ; self . mode = AfterHead ; Done
115
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
116
kind : crate :: tokenizer :: StartTag , name : local_name ! ("template") , ..
117
}) => {
118
self . insert_element_for (tag) ; self . active_formatting . push (Marker) ; self . frameset_ok = false ; self . mode = InTemplate ; self . template_modes . push (InTemplate) ; Done
119
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
120
kind : crate :: tokenizer :: EndTag , name : local_name ! ("template") , ..
121
}) => {
122
if ! self . in_html_elem_named (local_name ! ("template")) {
123
self . unexpected (& tag) ;
124
} else {
125
self . generate_implied_end (thorough_implied_end) ; self . expect_to_close (local_name ! ("template")) ; self . clear_active_formatting_to_marker () ; self . template_modes . pop () ; self . mode = self . reset_insertion_mode () ;
126
} Done
127
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
128
kind : crate :: tokenizer :: StartTag , name : local_name ! ("head") , ..
129
14
}) => self . unexpected (& token) , last_arm_token => {
130
14
let enable_wildcards = match last_arm_token {
131
crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
132
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
133
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
134
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
135
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
136
kind : crate :: tokenizer :: EndTag , name : local_name ! ("br") , ..
137
14
}) => false , _ => true ,
138
14
} ; match (enable_wildcards , last_arm_token) {
139
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
140
kind : crate :: tokenizer :: EndTag , ..
141
14
})) => self . unexpected (& tag) , (_ , token) => {
142
14
self . pop () ; Reprocess (AfterHead , token)
143
} ,
144
}
145
}
146
} , InHeadNoscript => match token {
147
crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
148
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
149
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
150
kind : crate :: tokenizer :: EndTag , name : local_name ! ("noscript") , ..
151
}) => {
152
self . pop () ; self . mode = InHead ; Done
153
} , CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , _) => self . step (InHead , token) , CommentToken (_) => self . step (InHead , token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
154
kind : crate :: tokenizer :: StartTag , name : local_name ! ("basefont") , ..
155
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
156
kind : crate :: tokenizer :: StartTag , name : local_name ! ("bgsound") , ..
157
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
158
kind : crate :: tokenizer :: StartTag , name : local_name ! ("link") , ..
159
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
160
kind : crate :: tokenizer :: StartTag , name : local_name ! ("meta") , ..
161
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
162
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noframes") , ..
163
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
164
kind : crate :: tokenizer :: StartTag , name : local_name ! ("style") , ..
165
}) => self . step (InHead , token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
166
kind : crate :: tokenizer :: StartTag , name : local_name ! ("head") , ..
167
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
168
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noscript") , ..
169
}) => self . unexpected (& token) , last_arm_token => {
170
let enable_wildcards = match last_arm_token {
171
crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
172
kind : crate :: tokenizer :: EndTag , name : local_name ! ("br") , ..
173
}) => false , _ => true ,
174
} ; match (enable_wildcards , last_arm_token) {
175
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
176
kind : crate :: tokenizer :: EndTag , ..
177
})) => self . unexpected (& tag) , (_ , token) => {
178
self . unexpected (& token) ; self . pop () ; Reprocess (InHead , token)
179
} ,
180
}
181
}
182
501
} , AfterHead => match token {
183
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , text) => self . append_text (text) , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
184
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
185
501
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
186
501
kind : crate :: tokenizer :: StartTag , name : local_name ! ("body") , ..
187
501
}) => {
188
501
self . insert_element_for (tag) ; self . frameset_ok = false ; self . mode = InBody ; Done
189
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
190
kind : crate :: tokenizer :: StartTag , name : local_name ! ("frameset") , ..
191
}) => {
192
self . insert_element_for (tag) ; self . mode = InFrameset ; Done
193
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
194
kind : crate :: tokenizer :: StartTag , name : local_name ! ("base") , ..
195
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
196
kind : crate :: tokenizer :: StartTag , name : local_name ! ("basefont") , ..
197
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
198
kind : crate :: tokenizer :: StartTag , name : local_name ! ("bgsound") , ..
199
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
200
kind : crate :: tokenizer :: StartTag , name : local_name ! ("link") , ..
201
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
202
kind : crate :: tokenizer :: StartTag , name : local_name ! ("meta") , ..
203
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
204
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noframes") , ..
205
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
206
kind : crate :: tokenizer :: StartTag , name : local_name ! ("script") , ..
207
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
208
kind : crate :: tokenizer :: StartTag , name : local_name ! ("style") , ..
209
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
210
kind : crate :: tokenizer :: StartTag , name : local_name ! ("template") , ..
211
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
212
kind : crate :: tokenizer :: StartTag , name : local_name ! ("title") , ..
213
}) => {
214
self . unexpected (& token) ; let head = self . head_elem . as_ref () . expect ("no head element") . clone () ; self . push (& head) ; let result = self . step (InHead , token) ; self . remove_from_stack (& head) ; result
215
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
216
kind : crate :: tokenizer :: EndTag , name : local_name ! ("template") , ..
217
}) => self . step (InHead , token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
218
kind : crate :: tokenizer :: StartTag , name : local_name ! ("head") , ..
219
14
}) => self . unexpected (& token) , last_arm_token => {
220
14
let enable_wildcards = match last_arm_token {
221
crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
222
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
223
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
224
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
225
}) => false , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
226
kind : crate :: tokenizer :: EndTag , name : local_name ! ("br") , ..
227
14
}) => false , _ => true ,
228
14
} ; match (enable_wildcards , last_arm_token) {
229
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
230
kind : crate :: tokenizer :: EndTag , ..
231
14
})) => self . unexpected (& tag) , (_ , token) => {
232
14
self . insert_phantom (local_name ! ("body")) ; Reprocess (InBody , token)
233
} ,
234
}
235
}
236
136563
} , InBody => match token {
237
95121
NullCharacterToken => self . unexpected (& token) , CharacterTokens (_ , text) => {
238
95121
self . reconstruct_formatting () ; if any_not_whitespace (& text) {
239
62792
self . frameset_ok = false ;
240
95121
} self . append_text (text)
241
2078
} , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
242
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
243
}) => {
244
self . unexpected (& tag) ; if ! self . in_html_elem_named (local_name ! ("template")) {
245
let top = html_elem (& self . open_elems) ; self . sink . add_attrs_if_missing (top , tag . attrs) ;
246
} Done
247
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
248
kind : crate :: tokenizer :: StartTag , name : local_name ! ("base") , ..
249
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
250
kind : crate :: tokenizer :: StartTag , name : local_name ! ("basefont") , ..
251
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
252
kind : crate :: tokenizer :: StartTag , name : local_name ! ("bgsound") , ..
253
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
254
kind : crate :: tokenizer :: StartTag , name : local_name ! ("link") , ..
255
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
256
kind : crate :: tokenizer :: StartTag , name : local_name ! ("meta") , ..
257
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
258
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noframes") , ..
259
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
260
kind : crate :: tokenizer :: StartTag , name : local_name ! ("script") , ..
261
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
262
kind : crate :: tokenizer :: StartTag , name : local_name ! ("style") , ..
263
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
264
kind : crate :: tokenizer :: StartTag , name : local_name ! ("template") , ..
265
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
266
kind : crate :: tokenizer :: StartTag , name : local_name ! ("title") , ..
267
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
268
kind : crate :: tokenizer :: EndTag , name : local_name ! ("template") , ..
269
}) => {
270
self . step (InHead , token)
271
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
272
kind : crate :: tokenizer :: StartTag , name : local_name ! ("body") , ..
273
}) => {
274
self . unexpected (& tag) ; match self . body_elem () . cloned () {
275
Some (ref node) if self . open_elems . len () != 1 && ! self . in_html_elem_named (local_name ! ("template")) => {
276
self . frameset_ok = false ; self . sink . add_attrs_if_missing (node , tag . attrs)
277
} , _ => {
278
}
279
} Done
280
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
281
kind : crate :: tokenizer :: StartTag , name : local_name ! ("frameset") , ..
282
}) => {
283
self . unexpected (& tag) ; if ! self . frameset_ok {
284
return Done ;
285
} let body = unwrap_or_return ! (self . body_elem () , Done) . clone () ; self . sink . remove_from_parent (& body) ; self . open_elems . truncate (1) ; self . insert_element_for (tag) ; self . mode = InFrameset ; Done
286
} , EOFToken => {
287
14
if ! self . template_modes . is_empty () {
288
self . step (InTemplate , token)
289
} else {
290
14
self . check_body_end () ; self . stop_parsing ()
291
}
292
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
293
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
294
}) => {
295
501
if self . in_scope_named (default_scope , local_name ! ("body")) {
296
501
self . check_body_end () ; self . mode = AfterBody ;
297
501
} else {
298
self . sink . parse_error (Borrowed ("</body> with no <body> in scope")) ;
299
501
} Done
300
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
301
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
302
}) => {
303
if self . in_scope_named (default_scope , local_name ! ("body")) {
304
self . check_body_end () ; Reprocess (AfterBody , token)
305
} else {
306
self . sink . parse_error (Borrowed ("</html> with no <body> in scope")) ; Done
307
}
308
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
309
kind : crate :: tokenizer :: StartTag , name : local_name ! ("address") , ..
310
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
311
kind : crate :: tokenizer :: StartTag , name : local_name ! ("article") , ..
312
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
313
kind : crate :: tokenizer :: StartTag , name : local_name ! ("aside") , ..
314
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
315
kind : crate :: tokenizer :: StartTag , name : local_name ! ("blockquote") , ..
316
22
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
317
kind : crate :: tokenizer :: StartTag , name : local_name ! ("center") , ..
318
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
319
kind : crate :: tokenizer :: StartTag , name : local_name ! ("details") , ..
320
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
321
kind : crate :: tokenizer :: StartTag , name : local_name ! ("dialog") , ..
322
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
323
kind : crate :: tokenizer :: StartTag , name : local_name ! ("dir") , ..
324
700
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
325
kind : crate :: tokenizer :: StartTag , name : local_name ! ("div") , ..
326
1044
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
327
kind : crate :: tokenizer :: StartTag , name : local_name ! ("dl") , ..
328
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
329
kind : crate :: tokenizer :: StartTag , name : local_name ! ("fieldset") , ..
330
100
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
331
kind : crate :: tokenizer :: StartTag , name : local_name ! ("figcaption") , ..
332
100
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
333
kind : crate :: tokenizer :: StartTag , name : local_name ! ("figure") , ..
334
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
335
kind : crate :: tokenizer :: StartTag , name : local_name ! ("footer") , ..
336
4
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
337
kind : crate :: tokenizer :: StartTag , name : local_name ! ("header") , ..
338
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
339
kind : crate :: tokenizer :: StartTag , name : local_name ! ("hgroup") , ..
340
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
341
kind : crate :: tokenizer :: StartTag , name : local_name ! ("main") , ..
342
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
343
kind : crate :: tokenizer :: StartTag , name : local_name ! ("nav") , ..
344
116
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
345
kind : crate :: tokenizer :: StartTag , name : local_name ! ("ol") , ..
346
4477
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
347
kind : crate :: tokenizer :: StartTag , name : local_name ! ("p") , ..
348
1965
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
349
kind : crate :: tokenizer :: StartTag , name : local_name ! ("section") , ..
350
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
351
kind : crate :: tokenizer :: StartTag , name : local_name ! ("summary") , ..
352
1110
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
353
kind : crate :: tokenizer :: StartTag , name : local_name ! ("ul") , ..
354
}) => {
355
9638
self . close_p_element_in_button_scope () ; self . insert_element_for (tag) ; Done
356
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
357
kind : crate :: tokenizer :: StartTag , name : local_name ! ("menu") , ..
358
}) => {
359
self . close_p_element_in_button_scope () ; self . insert_element_for (tag) ; Done
360
2
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
361
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h1") , ..
362
1016
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
363
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h2") , ..
364
312
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
365
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h3") , ..
366
42
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
367
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h4") , ..
368
56
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
369
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h5") , ..
370
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
371
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h6") , ..
372
}) => {
373
1428
self . close_p_element_in_button_scope () ; if self . current_node_in (heading_tag) {
374
self . sink . parse_error (Borrowed ("nested heading tags")) ; self . pop () ;
375
1428
} self . insert_element_for (tag) ; Done
376
1048
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
377
kind : crate :: tokenizer :: StartTag , name : local_name ! ("pre") , ..
378
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
379
kind : crate :: tokenizer :: StartTag , name : local_name ! ("listing") , ..
380
}) => {
381
1048
self . close_p_element_in_button_scope () ; self . insert_element_for (tag) ; self . ignore_lf = true ; self . frameset_ok = false ; Done
382
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
383
kind : crate :: tokenizer :: StartTag , name : local_name ! ("form") , ..
384
}) => {
385
if self . form_elem . is_some () && ! self . in_html_elem_named (local_name ! ("template")) {
386
self . sink . parse_error (Borrowed ("nested forms")) ;
387
} else {
388
self . close_p_element_in_button_scope () ; let elem = self . insert_element_for (tag) ; if ! self . in_html_elem_named (local_name ! ("template")) {
389
self . form_elem = Some (elem) ;
390
}
391
} Done
392
5586
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
393
kind : crate :: tokenizer :: StartTag , name : local_name ! ("li") , ..
394
1764
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
395
kind : crate :: tokenizer :: StartTag , name : local_name ! ("dd") , ..
396
34
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
397
kind : crate :: tokenizer :: StartTag , name : local_name ! ("dt") , ..
398
}) => {
399
7384
declare_tag_set ! (close_list = "li") ; declare_tag_set ! (close_defn = "dd" "dt") ; declare_tag_set ! (extra_special = [special_tag] - "address" "div" "p") ; let list = match tag . name {
400
5586
local_name ! ("li") => true , local_name ! ("dd") | local_name ! ("dt") => false , _ => unreachable ! () ,
401
7384
} ; self . frameset_ok = false ; let mut to_close = None ; for node in self . open_elems . iter () . rev () {
402
7384
let name = self . sink . elem_name (node) ; let can_close = if list {
403
5586
close_list (name)
404
} else {
405
1798
close_defn (name)
406
7384
} ; if can_close {
407
to_close = Some (name . local . clone ()) ; break ;
408
7384
} if extra_special (name) {
409
7384
break ;
410
}
411
7384
} match to_close {
412
Some (name) => {
413
self . generate_implied_end_except (name . clone ()) ; self . expect_to_close (name) ;
414
7384
} None => () ,
415
7384
} self . close_p_element_in_button_scope () ; self . insert_element_for (tag) ; Done
416
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
417
kind : crate :: tokenizer :: StartTag , name : local_name ! ("plaintext") , ..
418
}) => {
419
self . close_p_element_in_button_scope () ; self . insert_element_for (tag) ; ToPlaintext
420
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
421
kind : crate :: tokenizer :: StartTag , name : local_name ! ("button") , ..
422
}) => {
423
if self . in_scope_named (default_scope , local_name ! ("button")) {
424
self . sink . parse_error (Borrowed ("nested buttons")) ; self . generate_implied_end (cursory_implied_end) ; self . pop_until_named (local_name ! ("button")) ;
425
} self . reconstruct_formatting () ; self . insert_element_for (tag) ; self . frameset_ok = false ; Done
426
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
427
kind : crate :: tokenizer :: EndTag , name : local_name ! ("address") , ..
428
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
429
kind : crate :: tokenizer :: EndTag , name : local_name ! ("article") , ..
430
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
431
kind : crate :: tokenizer :: EndTag , name : local_name ! ("aside") , ..
432
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
433
kind : crate :: tokenizer :: EndTag , name : local_name ! ("blockquote") , ..
434
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
435
kind : crate :: tokenizer :: EndTag , name : local_name ! ("button") , ..
436
22
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
437
kind : crate :: tokenizer :: EndTag , name : local_name ! ("center") , ..
438
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
439
kind : crate :: tokenizer :: EndTag , name : local_name ! ("details") , ..
440
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
441
kind : crate :: tokenizer :: EndTag , name : local_name ! ("dialog") , ..
442
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
443
kind : crate :: tokenizer :: EndTag , name : local_name ! ("dir") , ..
444
700
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
445
kind : crate :: tokenizer :: EndTag , name : local_name ! ("div") , ..
446
1044
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
447
kind : crate :: tokenizer :: EndTag , name : local_name ! ("dl") , ..
448
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
449
kind : crate :: tokenizer :: EndTag , name : local_name ! ("fieldset") , ..
450
100
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
451
kind : crate :: tokenizer :: EndTag , name : local_name ! ("figcaption") , ..
452
100
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
453
kind : crate :: tokenizer :: EndTag , name : local_name ! ("figure") , ..
454
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
455
kind : crate :: tokenizer :: EndTag , name : local_name ! ("footer") , ..
456
4
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
457
kind : crate :: tokenizer :: EndTag , name : local_name ! ("header") , ..
458
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
459
kind : crate :: tokenizer :: EndTag , name : local_name ! ("hgroup") , ..
460
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
461
kind : crate :: tokenizer :: EndTag , name : local_name ! ("listing") , ..
462
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
463
kind : crate :: tokenizer :: EndTag , name : local_name ! ("main") , ..
464
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
465
kind : crate :: tokenizer :: EndTag , name : local_name ! ("menu") , ..
466
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
467
kind : crate :: tokenizer :: EndTag , name : local_name ! ("nav") , ..
468
116
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
469
kind : crate :: tokenizer :: EndTag , name : local_name ! ("ol") , ..
470
1048
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
471
kind : crate :: tokenizer :: EndTag , name : local_name ! ("pre") , ..
472
1965
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
473
kind : crate :: tokenizer :: EndTag , name : local_name ! ("section") , ..
474
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
475
kind : crate :: tokenizer :: EndTag , name : local_name ! ("summary") , ..
476
1110
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
477
kind : crate :: tokenizer :: EndTag , name : local_name ! ("ul") , ..
478
}) => {
479
6209
if ! self . in_scope_named (default_scope , tag . name . clone ()) {
480
self . unexpected (& tag) ;
481
6209
} else {
482
6209
self . generate_implied_end (cursory_implied_end) ; self . expect_to_close (tag . name) ;
483
6209
} Done
484
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
485
kind : crate :: tokenizer :: EndTag , name : local_name ! ("form") , ..
486
}) => {
487
if ! self . in_html_elem_named (local_name ! ("template")) {
488
let node = match self . form_elem . take () {
489
None => {
490
self . sink . parse_error (Borrowed ("Null form element pointer on </form>")) ; return Done ;
491
} Some (x) => x ,
492
} ; if ! self . in_scope (default_scope , | n | self . sink . same_node (& node , & n)) {
493
self . sink . parse_error (Borrowed ("Form element not in scope on </form>")) ; return Done ;
494
} self . generate_implied_end (cursory_implied_end) ; let current = self . current_node () . clone () ; self . remove_from_stack (& node) ; if ! self . sink . same_node (& current , & node) {
495
self . sink . parse_error (Borrowed ("Bad open element on </form>")) ;
496
}
497
} else {
498
if ! self . in_scope_named (default_scope , local_name ! ("form")) {
499
self . sink . parse_error (Borrowed ("Form element not in scope on </form>")) ; return Done ;
500
} self . generate_implied_end (cursory_implied_end) ; if ! self . current_node_named (local_name ! ("form")) {
501
self . sink . parse_error (Borrowed ("Bad open element on </form>")) ;
502
} self . pop_until_named (local_name ! ("form")) ;
503
} Done
504
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
505
kind : crate :: tokenizer :: EndTag , name : local_name ! ("p") , ..
506
}) => {
507
4477
if ! self . in_scope_named (button_scope , local_name ! ("p")) {
508
self . sink . parse_error (Borrowed ("No <p> tag to close")) ; self . insert_phantom (local_name ! ("p")) ;
509
4477
} self . close_p_element () ; Done
510
5586
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
511
kind : crate :: tokenizer :: EndTag , name : local_name ! ("li") , ..
512
1764
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
513
kind : crate :: tokenizer :: EndTag , name : local_name ! ("dd") , ..
514
34
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
515
kind : crate :: tokenizer :: EndTag , name : local_name ! ("dt") , ..
516
}) => {
517
7384
let in_scope = if tag . name == local_name ! ("li") {
518
5586
self . in_scope_named (list_item_scope , tag . name . clone ())
519
} else {
520
1798
self . in_scope_named (default_scope , tag . name . clone ())
521
7384
} ; if in_scope {
522
7384
self . generate_implied_end_except (tag . name . clone ()) ; self . expect_to_close (tag . name) ;
523
7384
} else {
524
self . sink . parse_error (Borrowed ("No matching tag to close")) ;
525
7384
} Done
526
2
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
527
kind : crate :: tokenizer :: EndTag , name : local_name ! ("h1") , ..
528
1016
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
529
kind : crate :: tokenizer :: EndTag , name : local_name ! ("h2") , ..
530
312
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
531
kind : crate :: tokenizer :: EndTag , name : local_name ! ("h3") , ..
532
42
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
533
kind : crate :: tokenizer :: EndTag , name : local_name ! ("h4") , ..
534
56
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
535
kind : crate :: tokenizer :: EndTag , name : local_name ! ("h5") , ..
536
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
537
kind : crate :: tokenizer :: EndTag , name : local_name ! ("h6") , ..
538
}) => {
539
1428
if self . in_scope (default_scope , | n | self . elem_in (& n , heading_tag)) {
540
1428
self . generate_implied_end (cursory_implied_end) ; if ! self . current_node_named (tag . name) {
541
self . sink . parse_error (Borrowed ("Closing wrong heading tag")) ;
542
1428
} self . pop_until (heading_tag) ;
543
} else {
544
self . sink . parse_error (Borrowed ("No heading tag to close")) ;
545
1428
} Done
546
12688
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
547
12688
kind : crate :: tokenizer :: StartTag , name : local_name ! ("a") , ..
548
12688
}) => {
549
12688
self . handle_misnested_a_tags (& tag) ; self . reconstruct_formatting () ; self . create_formatting_element_for (tag) ; Done
550
2028
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
551
kind : crate :: tokenizer :: StartTag , name : local_name ! ("b") , ..
552
22
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
553
kind : crate :: tokenizer :: StartTag , name : local_name ! ("big") , ..
554
1190
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
555
kind : crate :: tokenizer :: StartTag , name : local_name ! ("code") , ..
556
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
557
kind : crate :: tokenizer :: StartTag , name : local_name ! ("em") , ..
558
6
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
559
kind : crate :: tokenizer :: StartTag , name : local_name ! ("font") , ..
560
450
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
561
kind : crate :: tokenizer :: StartTag , name : local_name ! ("i") , ..
562
154
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
563
kind : crate :: tokenizer :: StartTag , name : local_name ! ("s") , ..
564
146
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
565
kind : crate :: tokenizer :: StartTag , name : local_name ! ("small") , ..
566
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
567
kind : crate :: tokenizer :: StartTag , name : local_name ! ("strike") , ..
568
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
569
kind : crate :: tokenizer :: StartTag , name : local_name ! ("strong") , ..
570
2640
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
571
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tt") , ..
572
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
573
kind : crate :: tokenizer :: StartTag , name : local_name ! ("u") , ..
574
}) => {
575
6636
self . reconstruct_formatting () ; self . create_formatting_element_for (tag) ; Done
576
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
577
kind : crate :: tokenizer :: StartTag , name : local_name ! ("nobr") , ..
578
}) => {
579
self . reconstruct_formatting () ; if self . in_scope_named (default_scope , local_name ! ("nobr")) {
580
self . sink . parse_error (Borrowed ("Nested <nobr>")) ; self . adoption_agency (local_name ! ("nobr")) ; self . reconstruct_formatting () ;
581
} self . create_formatting_element_for (tag) ; Done
582
12688
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
583
kind : crate :: tokenizer :: EndTag , name : local_name ! ("a") , ..
584
2028
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
585
kind : crate :: tokenizer :: EndTag , name : local_name ! ("b") , ..
586
22
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
587
kind : crate :: tokenizer :: EndTag , name : local_name ! ("big") , ..
588
1190
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
589
kind : crate :: tokenizer :: EndTag , name : local_name ! ("code") , ..
590
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
591
kind : crate :: tokenizer :: EndTag , name : local_name ! ("em") , ..
592
6
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
593
kind : crate :: tokenizer :: EndTag , name : local_name ! ("font") , ..
594
450
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
595
kind : crate :: tokenizer :: EndTag , name : local_name ! ("i") , ..
596
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
597
kind : crate :: tokenizer :: EndTag , name : local_name ! ("nobr") , ..
598
154
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
599
kind : crate :: tokenizer :: EndTag , name : local_name ! ("s") , ..
600
146
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
601
kind : crate :: tokenizer :: EndTag , name : local_name ! ("small") , ..
602
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
603
kind : crate :: tokenizer :: EndTag , name : local_name ! ("strike") , ..
604
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
605
kind : crate :: tokenizer :: EndTag , name : local_name ! ("strong") , ..
606
2640
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
607
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tt") , ..
608
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
609
kind : crate :: tokenizer :: EndTag , name : local_name ! ("u") , ..
610
}) => {
611
19324
self . adoption_agency (tag . name) ; Done
612
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
613
kind : crate :: tokenizer :: StartTag , name : local_name ! ("applet") , ..
614
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
615
kind : crate :: tokenizer :: StartTag , name : local_name ! ("marquee") , ..
616
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
617
kind : crate :: tokenizer :: StartTag , name : local_name ! ("object") , ..
618
}) => {
619
self . reconstruct_formatting () ; self . insert_element_for (tag) ; self . active_formatting . push (Marker) ; self . frameset_ok = false ; Done
620
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
621
kind : crate :: tokenizer :: EndTag , name : local_name ! ("applet") , ..
622
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
623
kind : crate :: tokenizer :: EndTag , name : local_name ! ("marquee") , ..
624
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
625
kind : crate :: tokenizer :: EndTag , name : local_name ! ("object") , ..
626
}) => {
627
if ! self . in_scope_named (default_scope , tag . name . clone ()) {
628
self . unexpected (& tag) ;
629
} else {
630
self . generate_implied_end (cursory_implied_end) ; self . expect_to_close (tag . name) ; self . clear_active_formatting_to_marker () ;
631
} Done
632
186
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
633
186
kind : crate :: tokenizer :: StartTag , name : local_name ! ("table") , ..
634
186
}) => {
635
186
if self . quirks_mode != Quirks {
636
186
self . close_p_element_in_button_scope () ;
637
186
} self . insert_element_for (tag) ; self . frameset_ok = false ; self . mode = InTable ; Done
638
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
639
kind : crate :: tokenizer :: EndTag , name : local_name ! ("br") , ..
640
}) => {
641
self . unexpected (& tag) ; self . step (InBody , TagToken (Tag {
642
kind : StartTag , attrs : vec ! () , .. tag
643
}))
644
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
645
kind : crate :: tokenizer :: StartTag , name : local_name ! ("area") , ..
646
786
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
647
kind : crate :: tokenizer :: StartTag , name : local_name ! ("br") , ..
648
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
649
kind : crate :: tokenizer :: StartTag , name : local_name ! ("embed") , ..
650
676
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
651
kind : crate :: tokenizer :: StartTag , name : local_name ! ("img") , ..
652
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
653
kind : crate :: tokenizer :: StartTag , name : local_name ! ("keygen") , ..
654
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
655
kind : crate :: tokenizer :: StartTag , name : local_name ! ("wbr") , ..
656
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
657
kind : crate :: tokenizer :: StartTag , name : local_name ! ("input") , ..
658
}) => {
659
1462
let keep_frameset_ok = match tag . name {
660
1462
local_name ! ("input") => self . is_type_hidden (& tag) , _ => false ,
661
1462
} ; self . reconstruct_formatting () ; self . insert_and_pop_element_for (tag) ; if ! keep_frameset_ok {
662
1462
self . frameset_ok = false ;
663
1462
} DoneAckSelfClosing
664
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
665
kind : crate :: tokenizer :: StartTag , name : local_name ! ("param") , ..
666
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
667
kind : crate :: tokenizer :: StartTag , name : local_name ! ("source") , ..
668
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
669
kind : crate :: tokenizer :: StartTag , name : local_name ! ("track") , ..
670
}) => {
671
self . insert_and_pop_element_for (tag) ; DoneAckSelfClosing
672
72
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
673
72
kind : crate :: tokenizer :: StartTag , name : local_name ! ("hr") , ..
674
72
}) => {
675
72
self . close_p_element_in_button_scope () ; self . insert_and_pop_element_for (tag) ; self . frameset_ok = false ; DoneAckSelfClosing
676
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
677
kind : crate :: tokenizer :: StartTag , name : local_name ! ("image") , ..
678
}) => {
679
self . unexpected (& tag) ; self . step (InBody , TagToken (Tag {
680
name : local_name ! ("img") , .. tag
681
}))
682
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
683
kind : crate :: tokenizer :: StartTag , name : local_name ! ("textarea") , ..
684
}) => {
685
self . ignore_lf = true ; self . frameset_ok = false ; self . parse_raw_data (tag , Rcdata)
686
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
687
kind : crate :: tokenizer :: StartTag , name : local_name ! ("xmp") , ..
688
}) => {
689
self . close_p_element_in_button_scope () ; self . reconstruct_formatting () ; self . frameset_ok = false ; self . parse_raw_data (tag , Rawtext)
690
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
691
kind : crate :: tokenizer :: StartTag , name : local_name ! ("iframe") , ..
692
}) => {
693
self . frameset_ok = false ; self . parse_raw_data (tag , Rawtext)
694
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
695
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noembed") , ..
696
}) => {
697
self . parse_raw_data (tag , Rawtext)
698
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
699
kind : crate :: tokenizer :: StartTag , name : local_name ! ("select") , ..
700
}) => {
701
self . reconstruct_formatting () ; self . insert_element_for (tag) ; self . frameset_ok = false ; self . mode = match self . mode {
702
InTable | InCaption | InTableBody | InRow | InCell => InSelectInTable , _ => InSelect ,
703
} ; Done
704
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
705
kind : crate :: tokenizer :: StartTag , name : local_name ! ("optgroup") , ..
706
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
707
kind : crate :: tokenizer :: StartTag , name : local_name ! ("option") , ..
708
}) => {
709
if self . current_node_named (local_name ! ("option")) {
710
self . pop () ;
711
} self . reconstruct_formatting () ; self . insert_element_for (tag) ; Done
712
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
713
kind : crate :: tokenizer :: StartTag , name : local_name ! ("rb") , ..
714
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
715
kind : crate :: tokenizer :: StartTag , name : local_name ! ("rtc") , ..
716
}) => {
717
if self . in_scope_named (default_scope , local_name ! ("ruby")) {
718
self . generate_implied_end (cursory_implied_end) ;
719
} if ! self . current_node_named (local_name ! ("ruby")) {
720
self . unexpected (& tag) ;
721
} self . insert_element_for (tag) ; Done
722
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
723
kind : crate :: tokenizer :: StartTag , name : local_name ! ("rp") , ..
724
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
725
kind : crate :: tokenizer :: StartTag , name : local_name ! ("rt") , ..
726
}) => {
727
if self . in_scope_named (default_scope , local_name ! ("ruby")) {
728
self . generate_implied_end_except (local_name ! ("rtc")) ;
729
} if ! self . current_node_named (local_name ! ("rtc")) && ! self . current_node_named (local_name ! ("ruby")) {
730
self . unexpected (& tag) ;
731
} self . insert_element_for (tag) ; Done
732
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
733
kind : crate :: tokenizer :: StartTag , name : local_name ! ("math") , ..
734
}) => self . enter_foreign (tag , ns ! (mathml)) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
735
kind : crate :: tokenizer :: StartTag , name : local_name ! ("svg") , ..
736
}) => self . enter_foreign (tag , ns ! (svg)) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
737
kind : crate :: tokenizer :: StartTag , name : local_name ! ("caption") , ..
738
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
739
kind : crate :: tokenizer :: StartTag , name : local_name ! ("col") , ..
740
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
741
kind : crate :: tokenizer :: StartTag , name : local_name ! ("colgroup") , ..
742
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
743
kind : crate :: tokenizer :: StartTag , name : local_name ! ("frame") , ..
744
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
745
kind : crate :: tokenizer :: StartTag , name : local_name ! ("head") , ..
746
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
747
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tbody") , ..
748
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
749
kind : crate :: tokenizer :: StartTag , name : local_name ! ("td") , ..
750
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
751
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tfoot") , ..
752
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
753
kind : crate :: tokenizer :: StartTag , name : local_name ! ("th") , ..
754
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
755
kind : crate :: tokenizer :: StartTag , name : local_name ! ("thead") , ..
756
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
757
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tr") , ..
758
}) => {
759
self . unexpected (& token) ; Done
760
50126
} , last_arm_token => {
761
50126
let enable_wildcards = match last_arm_token {
762
50126
_ => true ,
763
50126
} ; match (enable_wildcards , last_arm_token) {
764
25063
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
765
25063
kind : crate :: tokenizer :: StartTag , ..
766
25063
})) => {
767
25063
if self . opts . scripting_enabled && tag . name == local_name ! ("noscript") {
768
self . parse_raw_data (tag , Rawtext)
769
} else {
770
25063
self . reconstruct_formatting () ; self . insert_element_for (tag) ; Done
771
}
772
25063
} , (true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
773
25063
kind : crate :: tokenizer :: EndTag , ..
774
25063
})) => {
775
25063
self . process_end_tag_in_body (tag) ; Done
776
} , (_ , _) => panic ! ("impossible case in InBody mode") ,
777
}
778
}
779
1142
} , Text => match token {
780
571
CharacterTokens (_ , text) => self . append_text (text) , EOFToken => {
781
self . unexpected (& token) ; if self . current_node_named (local_name ! ("script")) {
782
let current = current_node (& self . open_elems) ; self . sink . mark_script_already_started (current) ;
783
} self . pop () ; Reprocess (self . orig_mode . take () . unwrap () , token)
784
571
} , last_arm_token => {
785
571
let enable_wildcards = match last_arm_token {
786
571
_ => true ,
787
571
} ; match (enable_wildcards , last_arm_token) {
788
571
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
789
571
kind : crate :: tokenizer :: EndTag , ..
790
571
})) => {
791
571
let node = self . pop () ; self . mode = self . orig_mode . take () . unwrap () ; if tag . name == local_name ! ("script") {
792
return Script (node) ;
793
571
} Done
794
} , (_ , _) => panic ! ("impossible case in Text mode") ,
795
}
796
}
797
388
} , InTable => match token {
798
1624
NullCharacterToken => self . process_chars_in_table (token) , CharacterTokens (..) => self . process_chars_in_table (token) , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
799
12
kind : crate :: tokenizer :: StartTag , name : local_name ! ("caption") , ..
800
12
}) => {
801
12
self . pop_until_current (table_scope) ; self . active_formatting . push (Marker) ; self . insert_element_for (tag) ; self . mode = InCaption ; Done
802
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
803
kind : crate :: tokenizer :: StartTag , name : local_name ! ("colgroup") , ..
804
}) => {
805
self . pop_until_current (table_scope) ; self . insert_element_for (tag) ; self . mode = InColumnGroup ; Done
806
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
807
kind : crate :: tokenizer :: StartTag , name : local_name ! ("col") , ..
808
}) => {
809
self . pop_until_current (table_scope) ; self . insert_phantom (local_name ! ("colgroup")) ; Reprocess (InColumnGroup , token)
810
186
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
811
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tbody") , ..
812
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
813
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tfoot") , ..
814
4
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
815
kind : crate :: tokenizer :: StartTag , name : local_name ! ("thead") , ..
816
}) => {
817
190
self . pop_until_current (table_scope) ; self . insert_element_for (tag) ; self . mode = InTableBody ; Done
818
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
819
kind : crate :: tokenizer :: StartTag , name : local_name ! ("td") , ..
820
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
821
kind : crate :: tokenizer :: StartTag , name : local_name ! ("th") , ..
822
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
823
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tr") , ..
824
}) => {
825
self . pop_until_current (table_scope) ; self . insert_phantom (local_name ! ("tbody")) ; Reprocess (InTableBody , token)
826
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
827
kind : crate :: tokenizer :: StartTag , name : local_name ! ("table") , ..
828
}) => {
829
self . unexpected (& token) ; if self . in_scope_named (table_scope , local_name ! ("table")) {
830
self . pop_until_named (local_name ! ("table")) ; Reprocess (self . reset_insertion_mode () , token)
831
} else {
832
Done
833
}
834
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
835
kind : crate :: tokenizer :: EndTag , name : local_name ! ("table") , ..
836
}) => {
837
186
if self . in_scope_named (table_scope , local_name ! ("table")) {
838
186
self . pop_until_named (local_name ! ("table")) ; self . mode = self . reset_insertion_mode () ;
839
186
} else {
840
self . unexpected (& token) ;
841
186
} Done
842
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
843
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
844
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
845
kind : crate :: tokenizer :: EndTag , name : local_name ! ("caption") , ..
846
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
847
kind : crate :: tokenizer :: EndTag , name : local_name ! ("col") , ..
848
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
849
kind : crate :: tokenizer :: EndTag , name : local_name ! ("colgroup") , ..
850
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
851
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
852
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
853
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tbody") , ..
854
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
855
kind : crate :: tokenizer :: EndTag , name : local_name ! ("td") , ..
856
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
857
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tfoot") , ..
858
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
859
kind : crate :: tokenizer :: EndTag , name : local_name ! ("th") , ..
860
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
861
kind : crate :: tokenizer :: EndTag , name : local_name ! ("thead") , ..
862
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
863
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tr") , ..
864
}) => self . unexpected (& token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
865
kind : crate :: tokenizer :: StartTag , name : local_name ! ("style") , ..
866
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
867
kind : crate :: tokenizer :: StartTag , name : local_name ! ("script") , ..
868
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
869
kind : crate :: tokenizer :: StartTag , name : local_name ! ("template") , ..
870
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
871
kind : crate :: tokenizer :: EndTag , name : local_name ! ("template") , ..
872
}) => self . step (InHead , token) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
873
kind : crate :: tokenizer :: StartTag , name : local_name ! ("input") , ..
874
}) => {
875
self . unexpected (& tag) ; if self . is_type_hidden (& tag) {
876
self . insert_and_pop_element_for (tag) ; DoneAckSelfClosing
877
} else {
878
self . foster_parent_in_body (TagToken (tag))
879
}
880
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
881
kind : crate :: tokenizer :: StartTag , name : local_name ! ("form") , ..
882
}) => {
883
self . unexpected (& tag) ; if ! self . in_html_elem_named (local_name ! ("template")) && self . form_elem . is_none () {
884
self . form_elem = Some (self . insert_and_pop_element_for (tag)) ;
885
} Done
886
} , EOFToken => self . step (InBody , token) , last_arm_token => {
887
let enable_wildcards = match last_arm_token {
888
_ => true ,
889
} ; match (enable_wildcards , last_arm_token) {
890
(_ , token) => {
891
self . unexpected (& token) ; self . foster_parent_in_body (token)
892
} ,
893
}
894
}
895
3376
} , InTableText => match token {
896
1752
NullCharacterToken => self . unexpected (& token) , CharacterTokens (split , text) => {
897
1752
self . pending_table_text . push ((split , text)) ; Done
898
1624
} , last_arm_token => {
899
1624
let enable_wildcards = match last_arm_token {
900
1624
_ => true ,
901
1624
} ; match (enable_wildcards , last_arm_token) {
902
1624
(_ , token) => {
903
1752
let pending = replace (& mut self . pending_table_text , vec ! ()) ; let contains_nonspace = pending . iter () . any (| & (split , ref text) | {
904
1752
match split {
905
1752
Whitespace => false , NotWhitespace => true , NotSplit => any_not_whitespace (text) ,
906
}
907
1752
}) ; if contains_nonspace {
908
self . sink . parse_error (Borrowed ("Non-space table text")) ; for (split , text) in pending . into_iter () {
909
match self . foster_parent_in_body (CharacterTokens (split , text)) {
910
Done => () , _ => panic ! ("not prepared to handle this!") ,
911
}
912
}
913
} else {
914
1752
for (_ , text) in pending . into_iter () {
915
1752
self . append_text (text) ;
916
1752
}
917
1624
} Reprocess (self . orig_mode . take () . unwrap () , token)
918
} ,
919
}
920
}
921
68
} , InCaption => match token {
922
crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
923
kind : crate :: tokenizer :: StartTag , name : local_name ! ("caption") , ..
924
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
925
kind : crate :: tokenizer :: StartTag , name : local_name ! ("col") , ..
926
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
927
kind : crate :: tokenizer :: StartTag , name : local_name ! ("colgroup") , ..
928
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
929
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tbody") , ..
930
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
931
kind : crate :: tokenizer :: StartTag , name : local_name ! ("td") , ..
932
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
933
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tfoot") , ..
934
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
935
kind : crate :: tokenizer :: StartTag , name : local_name ! ("th") , ..
936
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
937
kind : crate :: tokenizer :: StartTag , name : local_name ! ("thead") , ..
938
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
939
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tr") , ..
940
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
941
kind : crate :: tokenizer :: EndTag , name : local_name ! ("table") , ..
942
12
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
943
kind : crate :: tokenizer :: EndTag , name : local_name ! ("caption") , ..
944
}) => {
945
12
if self . in_scope_named (table_scope , local_name ! ("caption")) {
946
12
self . generate_implied_end (cursory_implied_end) ; self . expect_to_close (local_name ! ("caption")) ; self . clear_active_formatting_to_marker () ; match tag {
947
Tag {
948
kind : EndTag , name : local_name ! ("caption") , ..
949
} => {
950
12
self . mode = InTable ; Done
951
} _ => Reprocess (InTable , TagToken (tag))
952
}
953
} else {
954
self . unexpected (& tag) ; Done
955
}
956
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
957
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
958
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
959
kind : crate :: tokenizer :: EndTag , name : local_name ! ("col") , ..
960
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
961
kind : crate :: tokenizer :: EndTag , name : local_name ! ("colgroup") , ..
962
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
963
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
964
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
965
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tbody") , ..
966
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
967
kind : crate :: tokenizer :: EndTag , name : local_name ! ("td") , ..
968
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
969
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tfoot") , ..
970
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
971
kind : crate :: tokenizer :: EndTag , name : local_name ! ("th") , ..
972
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
973
kind : crate :: tokenizer :: EndTag , name : local_name ! ("thead") , ..
974
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
975
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tr") , ..
976
72
}) => self . unexpected (& token) , last_arm_token => {
977
72
let enable_wildcards = match last_arm_token {
978
72
_ => true ,
979
72
} ; match (enable_wildcards , last_arm_token) {
980
72
(_ , token) => self . step (InBody , token) ,
981
}
982
}
983
} , InColumnGroup => match token {
984
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , text) => self . append_text (text) , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
985
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
986
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
987
kind : crate :: tokenizer :: StartTag , name : local_name ! ("col") , ..
988
}) => {
989
self . insert_and_pop_element_for (tag) ; DoneAckSelfClosing
990
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
991
kind : crate :: tokenizer :: EndTag , name : local_name ! ("colgroup") , ..
992
}) => {
993
if self . current_node_named (local_name ! ("colgroup")) {
994
self . pop () ; self . mode = InTable ;
995
} else {
996
self . unexpected (& token) ;
997
} Done
998
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
999
kind : crate :: tokenizer :: EndTag , name : local_name ! ("col") , ..
}) => self . unexpected (& token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("template") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("template") , ..
}) => self . step (InHead , token) , EOFToken => self . step (InBody , token) , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(_ , token) => {
if self . current_node_named (local_name ! ("colgroup")) {
self . pop () ; Reprocess (InTable , token)
} else {
self . unexpected (& token)
}
} ,
}
}
748
} , InTableBody => match token {
558
crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
558
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tr") , ..
558
}) => {
558
self . pop_until_current (table_body_context) ; self . insert_element_for (tag) ; self . mode = InRow ; Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("th") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("td") , ..
}) => {
self . unexpected (& token) ; self . pop_until_current (table_body_context) ; self . insert_phantom (local_name ! ("tr")) ; Reprocess (InRow , token)
186
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tfoot") , ..
4
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("thead") , ..
}) => {
190
if self . in_scope_named (table_scope , tag . name . clone ()) {
190
self . pop_until_current (table_body_context) ; self . pop () ; self . mode = InTable ;
190
} else {
self . unexpected (& tag) ;
190
} Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("col") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("colgroup") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tfoot") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("thead") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("table") , ..
}) => {
declare_tag_set ! (table_outer = "table" "tbody" "tfoot") ; if self . in_scope (table_scope , | e | self . elem_in (& e , table_outer)) {
self . pop_until_current (table_body_context) ; self . pop () ; Reprocess (InTable , token)
} else {
self . unexpected (& token)
}
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("col") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("colgroup") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("td") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("th") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tr") , ..
406
}) => self . unexpected (& token) , last_arm_token => {
406
let enable_wildcards = match last_arm_token {
406
_ => true ,
406
} ; match (enable_wildcards , last_arm_token) {
406
(_ , token) => self . step (InTable , token) ,
}
}
2106
} , InRow => match token {
226
crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("th") , ..
1322
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("td") , ..
}) => {
1548
self . pop_until_current (table_row_context) ; self . insert_element_for (tag) ; self . mode = InCell ; self . active_formatting . push (Marker) ; Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tr") , ..
}) => {
558
if self . in_scope_named (table_scope , local_name ! ("tr")) {
558
self . pop_until_current (table_row_context) ; let node = self . pop () ; self . assert_named (& node , local_name ! ("tr")) ; self . mode = InTableBody ;
558
} else {
self . unexpected (& token) ;
558
} Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("col") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("colgroup") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tfoot") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("thead") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tr") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("table") , ..
}) => {
if self . in_scope_named (table_scope , local_name ! ("tr")) {
self . pop_until_current (table_row_context) ; let node = self . pop () ; self . assert_named (& node , local_name ! ("tr")) ; Reprocess (InTableBody , token)
} else {
self . unexpected (& token)
}
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tfoot") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("thead") , ..
}) => {
if self . in_scope_named (table_scope , tag . name . clone ()) {
if self . in_scope_named (table_scope , local_name ! ("tr")) {
self . pop_until_current (table_row_context) ; let node = self . pop () ; self . assert_named (& node , local_name ! ("tr")) ; Reprocess (InTableBody , TagToken (tag))
} else {
Done
}
} else {
self . unexpected (& tag)
}
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("col") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("colgroup") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("td") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("th") , ..
1138
}) => self . unexpected (& token) , last_arm_token => {
1138
let enable_wildcards = match last_arm_token {
1138
_ => true ,
1138
} ; match (enable_wildcards , last_arm_token) {
1138
(_ , token) => self . step (InTable , token) ,
}
}
21650
} , InCell => match token {
1322
crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("td") , ..
226
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("th") , ..
}) => {
1548
if self . in_scope_named (table_scope , tag . name . clone ()) {
1548
self . generate_implied_end (cursory_implied_end) ; self . expect_to_close (tag . name) ; self . clear_active_formatting_to_marker () ; self . mode = InRow ;
1548
} else {
self . unexpected (& tag) ;
1548
} Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("col") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("colgroup") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("td") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tfoot") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("th") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("thead") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tr") , ..
}) => {
if self . in_scope (table_scope , | n | self . elem_in (& n , td_th)) {
self . close_the_cell () ; Reprocess (InRow , token)
} else {
self . unexpected (& token)
}
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("body") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("col") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("colgroup") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
}) => self . unexpected (& token) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("table") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tfoot") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("thead") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tr") , ..
}) => {
if self . in_scope_named (table_scope , tag . name . clone ()) {
self . close_the_cell () ; Reprocess (InRow , TagToken (tag))
} else {
self . unexpected (& tag)
}
33432
} , last_arm_token => {
33432
let enable_wildcards = match last_arm_token {
33432
_ => true ,
33432
} ; match (enable_wildcards , last_arm_token) {
33432
(_ , token) => self . step (InBody , token) ,
}
}
} , InSelect => match token {
NullCharacterToken => self . unexpected (& token) , CharacterTokens (_ , text) => self . append_text (text) , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("option") , ..
}) => {
if self . current_node_named (local_name ! ("option")) {
self . pop () ;
} self . insert_element_for (tag) ; Done
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("optgroup") , ..
}) => {
if self . current_node_named (local_name ! ("option")) {
self . pop () ;
} if self . current_node_named (local_name ! ("optgroup")) {
self . pop () ;
} self . insert_element_for (tag) ; Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("optgroup") , ..
}) => {
if self . open_elems . len () >= 2 && self . current_node_named (local_name ! ("option")) && self . html_elem_named (& self . open_elems [self . open_elems . len () - 2] , local_name ! ("optgroup")) {
self . pop () ;
} if self . current_node_named (local_name ! ("optgroup")) {
self . pop () ;
} else {
self . unexpected (& token) ;
} Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("option") , ..
}) => {
if self . current_node_named (local_name ! ("option")) {
self . pop () ;
} else {
self . unexpected (& token) ;
} Done
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("select") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("select") , ..
}) => {
let in_scope = self . in_scope_named (select_scope , local_name ! ("select")) ; if ! in_scope || tag . kind == StartTag {
self . unexpected (& tag) ;
} if in_scope {
self . pop_until_named (local_name ! ("select")) ; self . mode = self . reset_insertion_mode () ;
} Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("input") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("keygen") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("textarea") , ..
}) => {
self . unexpected (& token) ; if self . in_scope_named (select_scope , local_name ! ("select")) {
self . pop_until_named (local_name ! ("select")) ; Reprocess (self . reset_insertion_mode () , token)
} else {
Done
}
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("script") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("template") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("template") , ..
}) => self . step (InHead , token) , EOFToken => self . step (InBody , token) , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(_ , token) => self . unexpected (& token) ,
}
}
} , InSelectInTable => match token {
crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("table") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tfoot") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("thead") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tr") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("td") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("th") , ..
}) => {
self . unexpected (& token) ; self . pop_until_named (local_name ! ("select")) ; Reprocess (self . reset_insertion_mode () , token)
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("table") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tfoot") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("thead") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("tr") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("td") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("th") , ..
}) => {
self . unexpected (& tag) ; if self . in_scope_named (table_scope , tag . name . clone ()) {
self . pop_until_named (local_name ! ("select")) ; Reprocess (self . reset_insertion_mode () , TagToken (tag))
} else {
Done
}
} , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(_ , token) => self . step (InSelect , token) ,
}
}
} , InTemplate => match token {
CharacterTokens (_ , _) => self . step (InBody , token) , CommentToken (_) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("base") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("basefont") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("bgsound") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("link") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("meta") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noframes") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("script") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("style") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("template") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("title") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("template") , ..
}) => {
self . step (InHead , token)
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("caption") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("colgroup") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tbody") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tfoot") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("thead") , ..
}) => {
self . template_modes . pop () ; self . template_modes . push (InTable) ; Reprocess (InTable , token)
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("col") , ..
}) => {
self . template_modes . pop () ; self . template_modes . push (InColumnGroup) ; Reprocess (InColumnGroup , token)
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tr") , ..
}) => {
self . template_modes . pop () ; self . template_modes . push (InTableBody) ; Reprocess (InTableBody , token)
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("td") , ..
}) | crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("th") , ..
}) => {
self . template_modes . pop () ; self . template_modes . push (InRow) ; Reprocess (InRow , token)
} , EOFToken => {
if ! self . in_html_elem_named (local_name ! ("template")) {
self . stop_parsing ()
} else {
self . unexpected (& token) ; self . pop_until_named (local_name ! ("template")) ; self . clear_active_formatting_to_marker () ; self . template_modes . pop () ; self . mode = self . reset_insertion_mode () ; Reprocess (self . reset_insertion_mode () , token)
}
} , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , ..
})) => {
self . template_modes . pop () ; self . template_modes . push (InBody) ; Reprocess (InBody , TagToken (tag))
} , (_ , token) => self . unexpected (& token) ,
}
}
501
} , AfterBody => match token {
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , _) => self . step (InBody , token) , CommentToken (text) => self . append_comment_to_html (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
}) => {
501
if self . is_fragment () {
self . unexpected (& token) ;
501
} else {
501
self . mode = AfterAfterBody ;
501
} Done
} , EOFToken => self . stop_parsing () , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(_ , token) => {
self . unexpected (& token) ; Reprocess (InBody , token)
} ,
}
}
} , InFrameset => match token {
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , text) => self . append_text (text) , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("frameset") , ..
}) => {
self . insert_element_for (tag) ; Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("frameset") , ..
}) => {
if self . open_elems . len () == 1 {
self . unexpected (& token) ;
} else {
self . pop () ; if ! self . is_fragment () && ! self . current_node_named (local_name ! ("frameset")) {
self . mode = AfterFrameset ;
}
} Done
} , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("frame") , ..
}) => {
self . insert_and_pop_element_for (tag) ; DoneAckSelfClosing
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noframes") , ..
}) => self . step (InHead , token) , EOFToken => {
if self . open_elems . len () != 1 {
self . unexpected (& token) ;
} self . stop_parsing ()
} , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(_ , token) => self . unexpected (& token) ,
}
}
} , AfterFrameset => match token {
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , text) => self . append_text (text) , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
}) => self . step (InBody , token) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , name : local_name ! ("html") , ..
}) => {
self . mode = AfterAfterFrameset ; Done
} , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noframes") , ..
}) => self . step (InHead , token) , EOFToken => self . stop_parsing () , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(_ , token) => self . unexpected (& token) ,
}
}
} , AfterAfterBody => match token {
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , _) => self . step (InBody , token) , CommentToken (text) => self . append_comment_to_doc (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
501
}) => self . step (InBody , token) , EOFToken => self . stop_parsing () , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(_ , token) => {
self . unexpected (& token) ; Reprocess (InBody , token)
} ,
}
}
} , AfterAfterFrameset => match token {
CharacterTokens (NotSplit , text) => SplitWhitespace (text) , CharacterTokens (Whitespace , _) => self . step (InBody , token) , CommentToken (text) => self . append_comment_to_doc (text) , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("html") , ..
}) => self . step (InBody , token) , EOFToken => self . stop_parsing () , crate :: tree_builder :: types :: TagToken (crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("noframes") , ..
}) => self . step (InHead , token) , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(_ , token) => self . unexpected (& token) ,
}
}
} ,
}
290525
} fn step_foreign (& mut self , token : Token) -> ProcessResult < Handle > {
match token {
NullCharacterToken => {
self . unexpected (& token) ; self . append_text ("\u{fffd}" . to_tendril ())
} , CharacterTokens (_ , text) => {
if any_not_whitespace (& text) {
self . frameset_ok = false ;
} self . append_text (text)
} , CommentToken (text) => self . append_comment (text) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("b") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("big") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("blockquote") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("body") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("br") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("center") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("code") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("dd") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("div") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("dl") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("dt") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("em") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("embed") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h1") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h2") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h3") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h4") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h5") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("h6") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("head") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("hr") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("i") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("img") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("li") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("listing") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("menu") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("meta") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("nobr") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("ol") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("p") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("pre") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("ruby") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("s") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("small") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("span") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("strong") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("strike") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("sub") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("sup") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("table") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("tt") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("u") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("ul") , ..
}) | crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("var") , ..
}) => self . unexpected_start_tag_in_foreign_content (tag) , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , name : local_name ! ("font") , ..
}) => {
let unexpected = tag . attrs . iter () . any (| attr | {
matches ! (attr . name . expanded () , expanded_name ! ("" , "color") | expanded_name ! ("" , "face") | expanded_name ! ("" , "size"))
}) ; if unexpected {
self . unexpected_start_tag_in_foreign_content (tag)
} else {
self . foreign_start_tag (tag)
}
} , last_arm_token => {
let enable_wildcards = match last_arm_token {
_ => true ,
} ; match (enable_wildcards , last_arm_token) {
(true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: StartTag , ..
})) => self . foreign_start_tag (tag) , (true , crate :: tree_builder :: types :: TagToken (tag @ crate :: tokenizer :: Tag {
kind : crate :: tokenizer :: EndTag , ..
})) => {
let mut first = true ; let mut stack_idx = self . open_elems . len () - 1 ; loop {
if stack_idx == 0 {
return Done ;
} let html ; let eq ; {
let node_name = self . sink . elem_name (& self . open_elems [stack_idx]) ; html = * node_name . ns == ns ! (html) ; eq = node_name . local . eq_ignore_ascii_case (& tag . name) ;
} if ! first && html {
let mode = self . mode ; return self . step (mode , TagToken (tag)) ;
} if eq {
self . open_elems . truncate (stack_idx) ; return Done ;
} if first {
self . unexpected (& tag) ; first = false ;
} stack_idx -= 1 ;
}
} , (_ , _) => panic ! ("impossible case in foreign content") ,
}
}
}
}
}