File Coverage

blib/lib/HTML/HTML5/Parser/TagSoupParser.pm
Criterion Covered Total %
statement 2140 2861 74.8
branch 965 1418 68.0
condition 295 473 62.3
subroutine 38 54 70.3
pod 0 8 0.0
total 3438 4814 71.4


line stmt bran cond sub pod time code
1             package HTML::HTML5::Parser::TagSoupParser;
2              
3             ## skip Test::Tabs
4              
5             # This is a port of the Whatpm::HTML package away from dependencies
6             # on manakai, and towards CPAN and XML::LibXML.
7              
8             # http://suika.fam.cx/gate/git/wi/manakai.git/history/HEAD:/lib/Whatpm/HTML.pm
9             # CAUGHT UP TO d81fcb920a1a3c351149cd66a64bf1b8ae14a172 (2011-08-21)
10              
11 11     11   262 use 5.008001;
  11         41  
12 11     11   59 use strict;
  11         26  
  11         293  
13 11     11   88 no warnings;
  11         46  
  11         698  
14              
15             our $VERSION = '0.992';
16              
17 11     11   6170 use IO::Handle;
  11         66367  
  11         638  
18 11     11   16614 use HTML::HTML5::Parser::Tokenizer;
  11         80  
  11         1304  
19 11     11   149 use Scalar::Util qw(blessed);
  11         22  
  11         642  
20 11     11   6284 use Try::Tiny;
  11         20567  
  11         703  
21 11     11   8635 use XML::LibXML ':libxml';
  11         534024  
  11         91  
22 11     11   8219 use XML::LibXML::Devel;
  11         6408  
  11         1225  
23              
24             BEGIN
25             {
26 11 50   11   43 if (eval { require XML::LibXML::Devel::SetLineNumber; 1 })
  11         1881  
  0         0  
27             {
28 0         0 *HAS_XLXDSLN = sub () { 1 };
29             }
30             else
31             {
32 11         275215 *HAS_XLXDSLN = sub () { 0 };
33             }
34             }
35              
36             *XML::LibXML::Element::appendTextFromUnicode = sub
37             {
38 1259     1259   2586 my $element = shift;
39 1259 50       3696 my $parser = shift if ref $_[0];
40 1259         2182 my $text = shift; utf8::encode($text);
  1259         3513  
41 1259         1850 my $token = shift;
42            
43             # This prevents adjacent text nodes.
44 1259 100 100     7771 if (defined $element->lastChild
45             and $element->lastChild->nodeType == XML_TEXT_NODE)
46             {
47 524         2417 $element->appendText($text);
48 524         1026 return;
49             }
50              
51 735         4651 my $textnode = XML::LibXML::Text->new($text);
52              
53 735 100       5438 if ($token)
54             {
55             $parser->_data($textnode, manakai_source_line => $token->{line})
56 687 100 66     4180 if $parser and defined $token->{line};
57             $parser->_data($textnode, manakai_source_column => $token->{column})
58 687 100 66     3766 if $parser and defined $token->{column};
59              
60 687         1056 if (HAS_XLXDSLN
61             and exists $token->{line}
62             and int($token->{line})
63             and int($token->{line}) eq $token->{line})
64             {
65             $textnode->XML::LibXML::Devel::SetLineNumber::set_line_number($token->{line});
66             }
67             }
68              
69 735         4843 return $element->appendChild($textnode);
70             };
71              
72             our $DATA = {};
73             sub DATA {
74 10     10 0 27 _data(undef, @_);
75             }
76              
77             sub _data
78             {
79 20019     20019   31659 my $self = shift;
80 20019         39225 my ($object, $k, $v) = @_;
81 20019         29754 my $argc = @_;
82             # This method doesn't work for non XLxN things. Fail silently.
83 20019 50 33     95880 unless (blessed($object) and $object->isa('XML::LibXML::Node'))
84             {
85 0 0       0 return {} if $argc==1;
86 0         0 return;
87             }
88              
89             # This seems to work much better as a unique identifier for a
90             # node than refaddr does. However, it's not a supported use
91             # for XML::LibXML::Devel, so it might cause failures. We'll see.
92 20019         48486 my $oaddr = XML::LibXML::Devel::node_from_perl($object);
93 20019         27344 my $data;
94 20019 100       38298 if (ref $self) {
95 20009   100     63726 $data = $self->{_debug_cache}{$oaddr} ||= {};
96             }
97             else {
98 10   50     37 $data = $DATA->{$oaddr} ||= {};
99             }
100              
101 20019         29268 if (HAS_XLXDSLN
102             and defined $k
103             and $k eq 'manakai_source_line'
104             and defined $v
105             and int($v)
106             and int($v) eq $v
107             and $object->nodeType == XML_ELEMENT_NODE) # does not work well for attrs
108             {
109             $object->XML::LibXML::Devel::SetLineNumber::set_line_number($v);
110             }
111              
112 20019 100       50271 $data->{$k} = $v if $argc==3;
113 20019 100       35885 return $data->{$k} if $argc==2;
114 19821         40026 return $data;
115             }
116              
117             ## NOTE: This module don't check all HTML5 parse errors; character
118             ## encoding related parse errors are expected to be handled by relevant
119             ## modules.
120             ## Parse errors for control characters that are not allowed in HTML5
121             ## documents, for surrogate code points, and for noncharacter code
122             ## points, as well as U+FFFD substitions for characters whose code points
123             ## is higher than U+10FFFF may be detected by combining the parser with
124             ## the checker implemented by HTML::HTML5::Parser::Charset::UnicodeChecker (for its
125             ## usage example, see |t/HTML-tree.t| in the Whatpm package or the
126             ## WebHACC::Language::HTML module in the WebHACC package).
127              
128             ## ISSUE:
129             ## var doc = implementation.createDocument (null, null, null);
130             ## doc.write ('');
131             ## alert (doc.compatMode);
132              
133             ## Namespace URLs
134              
135             sub HTML_NS () { q }
136             sub MML_NS () { q }
137             sub SVG_NS () { q }
138             sub XLINK_NS () { q }
139             sub XML_NS () { q }
140             sub XMLNS_NS () { q }
141              
142             ## Element categories
143              
144             ## Bits 14-18
145             sub BUTTON_SCOPING_EL () { 0b1_000000000000000000 } ## Special
146             sub SPECIAL_EL () { 0b1_00000000000000000 } ## Special
147             sub SCOPING_EL () { 0b1_0000000000000000 } ## Special
148             sub FORMATTING_EL () { 0b1_000000000000000 } ## Formatting
149             sub PHRASING_EL () { 0b1_00000000000000 } ## Ordinary
150              
151             ## Bits 10-13
152             sub SVG_EL () { 0b1_0000000000000 }
153             sub MML_EL () { 0b1_000000000000 }
154             #sub FOREIGN_EL () { 0b1_00000000000 } # see HTML::HTML5::Parser::Tokenizer
155             sub FOREIGN_FLOW_CONTENT_EL () { 0b1_0000000000 }
156              
157             ## Bits 6-9
158             sub TABLE_SCOPING_EL () { 0b1_000000000 }
159             sub TABLE_ROWS_SCOPING_EL () { 0b1_00000000 }
160             sub TABLE_ROW_SCOPING_EL () { 0b1_0000000 }
161             sub TABLE_ROWS_EL () { 0b1_000000 }
162              
163             ## Bit 5
164             sub ADDRESS_DIV_P_EL () { 0b1_00000 }
165              
166             ## NOTE: Used in and EOF algorithms.
167             ## Bit 4
168             sub ALL_END_TAG_OPTIONAL_EL () { 0b1_0000 }
169              
170             ## NOTE: Used in "generate implied end tags" algorithm.
171             ## NOTE: There is a code where a modified version of
172             ## END_TAG_OPTIONAL_EL is used in "generate implied end tags"
173             ## implementation (search for the algorithm name).
174             ## Bit 3
175             sub END_TAG_OPTIONAL_EL () { 0b1_000 }
176              
177             ## Bits 0-2
178              
179             sub MISC_SPECIAL_EL () { SPECIAL_EL | 0b000 }
180             sub FORM_EL () { SPECIAL_EL | 0b001 }
181             sub FRAMESET_EL () { SPECIAL_EL | 0b010 }
182             sub HEADING_EL () { SPECIAL_EL | 0b011 }
183             sub SELECT_EL () { SPECIAL_EL | 0b100 }
184             sub SCRIPT_EL () { SPECIAL_EL | 0b101 }
185             sub BUTTON_EL () { SPECIAL_EL | BUTTON_SCOPING_EL | 0b110 }
186              
187             sub ADDRESS_DIV_EL () { SPECIAL_EL | ADDRESS_DIV_P_EL | 0b001 }
188             sub BODY_EL () { SPECIAL_EL | ALL_END_TAG_OPTIONAL_EL | 0b001 }
189              
190             sub DTDD_EL () {
191             SPECIAL_EL |
192             END_TAG_OPTIONAL_EL |
193             ALL_END_TAG_OPTIONAL_EL |
194             0b010
195             }
196             sub LI_EL () {
197             SPECIAL_EL |
198             END_TAG_OPTIONAL_EL |
199             ALL_END_TAG_OPTIONAL_EL |
200             0b100
201             }
202             sub P_EL () {
203             SPECIAL_EL |
204             ADDRESS_DIV_P_EL |
205             END_TAG_OPTIONAL_EL |
206             ALL_END_TAG_OPTIONAL_EL |
207             0b001
208             }
209              
210             sub TABLE_ROW_EL () {
211             SPECIAL_EL |
212             TABLE_ROWS_EL |
213             TABLE_ROW_SCOPING_EL |
214             ALL_END_TAG_OPTIONAL_EL |
215             0b001
216             }
217             sub TABLE_ROW_GROUP_EL () {
218             SPECIAL_EL |
219             TABLE_ROWS_EL |
220             TABLE_ROWS_SCOPING_EL |
221             ALL_END_TAG_OPTIONAL_EL |
222             0b001
223             }
224              
225             sub MISC_SCOPING_EL () { SCOPING_EL | BUTTON_SCOPING_EL | 0b000 }
226             sub CAPTION_EL () { SCOPING_EL | BUTTON_SCOPING_EL | 0b010 }
227             sub HTML_EL () {
228             SCOPING_EL |
229             BUTTON_SCOPING_EL |
230             TABLE_SCOPING_EL |
231             TABLE_ROWS_SCOPING_EL |
232             TABLE_ROW_SCOPING_EL |
233             ALL_END_TAG_OPTIONAL_EL |
234             0b001
235             }
236             sub TABLE_EL () {
237             SCOPING_EL |
238             BUTTON_SCOPING_EL |
239             TABLE_ROWS_EL |
240             TABLE_SCOPING_EL |
241             0b001
242             }
243             sub TABLE_CELL_EL () {
244             SCOPING_EL |
245             BUTTON_SCOPING_EL |
246             ALL_END_TAG_OPTIONAL_EL |
247             0b001
248             }
249              
250             sub MISC_FORMATTING_EL () { FORMATTING_EL | 0b000 }
251             sub A_EL () { FORMATTING_EL | 0b001 }
252             sub NOBR_EL () { FORMATTING_EL | 0b010 }
253              
254             sub RUBY_EL () { PHRASING_EL | 0b001 }
255              
256             ## NOTE: These elements are not included in |ALL_END_TAG_OPTIONAL_EL|.
257             sub OPTGROUP_EL () { PHRASING_EL | END_TAG_OPTIONAL_EL | 0b001 }
258             sub OPTION_EL () { PHRASING_EL | END_TAG_OPTIONAL_EL | 0b010 }
259             sub RUBY_COMPONENT_EL () { PHRASING_EL | END_TAG_OPTIONAL_EL | 0b100 }
260              
261             ## "MathML text integration point" elements.
262             sub MML_TEXT_INTEGRATION_EL () {
263             MML_EL |
264             SCOPING_EL |
265             BUTTON_SCOPING_EL |
266             FOREIGN_EL |
267             FOREIGN_FLOW_CONTENT_EL
268             } # MML_TEXT_INTEGRATION_EL
269              
270             sub MML_AXML_EL () {
271             MML_EL |
272             SCOPING_EL |
273             BUTTON_SCOPING_EL |
274             FOREIGN_EL |
275             0b001
276             } # MML_AXML_EL
277              
278             ## "HTML integration point" elements in SVG namespace.
279             sub SVG_INTEGRATION_EL () {
280             SVG_EL |
281             SCOPING_EL |
282             BUTTON_SCOPING_EL |
283             FOREIGN_EL |
284             FOREIGN_FLOW_CONTENT_EL
285             } # SVG_INTEGRATION_EL
286              
287             sub SVG_SCRIPT_EL () {
288             SVG_EL |
289             FOREIGN_EL |
290             0b101
291             } # SVG_SCRIPT_EL
292              
293             my $el_category = {
294             a => A_EL,
295             address => ADDRESS_DIV_EL,
296             applet => MISC_SCOPING_EL,
297             area => MISC_SPECIAL_EL,
298             article => MISC_SPECIAL_EL,
299             aside => MISC_SPECIAL_EL,
300             b => FORMATTING_EL,
301             base => MISC_SPECIAL_EL,
302             basefont => MISC_SPECIAL_EL,
303             bgsound => MISC_SPECIAL_EL,
304             big => FORMATTING_EL,
305             blockquote => MISC_SPECIAL_EL,
306             body => BODY_EL,
307             br => MISC_SPECIAL_EL,
308             button => BUTTON_EL,
309             caption => CAPTION_EL,
310             center => MISC_SPECIAL_EL,
311             code => FORMATTING_EL,
312             col => MISC_SPECIAL_EL,
313             colgroup => MISC_SPECIAL_EL,
314             command => MISC_SPECIAL_EL,
315             #datagrid => MISC_SPECIAL_EL,
316             dd => DTDD_EL,
317             details => MISC_SPECIAL_EL,
318             dir => MISC_SPECIAL_EL,
319             div => ADDRESS_DIV_EL,
320             dl => MISC_SPECIAL_EL,
321             dt => DTDD_EL,
322             em => FORMATTING_EL,
323             embed => MISC_SPECIAL_EL,
324             fieldset => MISC_SPECIAL_EL,
325             figure => MISC_SPECIAL_EL,
326             figcaption => MISC_SPECIAL_EL,
327             font => FORMATTING_EL,
328             footer => MISC_SPECIAL_EL,
329             form => FORM_EL,
330             frame => MISC_SPECIAL_EL,
331             frameset => FRAMESET_EL,
332             h1 => HEADING_EL,
333             h2 => HEADING_EL,
334             h3 => HEADING_EL,
335             h4 => HEADING_EL,
336             h5 => HEADING_EL,
337             h6 => HEADING_EL,
338             head => MISC_SPECIAL_EL,
339             header => MISC_SPECIAL_EL,
340             hgroup => MISC_SPECIAL_EL,
341             hr => MISC_SPECIAL_EL,
342             html => HTML_EL,
343             i => FORMATTING_EL,
344             iframe => MISC_SPECIAL_EL,
345             img => MISC_SPECIAL_EL,
346             #image => MISC_SPECIAL_EL, ## NOTE: Commented out in the spec.
347             input => MISC_SPECIAL_EL,
348             isindex => MISC_SPECIAL_EL,
349             ## XXX keygen? (Whether a void element is in Special or not does not
350             ## affect to the processing, however.)
351             li => LI_EL,
352             link => MISC_SPECIAL_EL,
353             listing => MISC_SPECIAL_EL,
354             marquee => MISC_SCOPING_EL,
355             menu => MISC_SPECIAL_EL,
356             meta => MISC_SPECIAL_EL,
357             nav => MISC_SPECIAL_EL,
358             nobr => NOBR_EL,
359             noembed => MISC_SPECIAL_EL,
360             noframes => MISC_SPECIAL_EL,
361             noscript => MISC_SPECIAL_EL,
362             object => MISC_SCOPING_EL,
363             ol => MISC_SPECIAL_EL,
364             optgroup => OPTGROUP_EL,
365             option => OPTION_EL,
366             p => P_EL,
367             param => MISC_SPECIAL_EL,
368             plaintext => MISC_SPECIAL_EL,
369             pre => MISC_SPECIAL_EL,
370             rp => RUBY_COMPONENT_EL,
371             rt => RUBY_COMPONENT_EL,
372             ruby => RUBY_EL,
373             s => FORMATTING_EL,
374             script => MISC_SPECIAL_EL,
375             select => SELECT_EL,
376             section => MISC_SPECIAL_EL,
377             small => FORMATTING_EL,
378             strike => FORMATTING_EL,
379             strong => FORMATTING_EL,
380             style => MISC_SPECIAL_EL,
381             summary => MISC_SPECIAL_EL,
382             table => TABLE_EL,
383             tbody => TABLE_ROW_GROUP_EL,
384             td => TABLE_CELL_EL,
385             textarea => MISC_SPECIAL_EL,
386             tfoot => TABLE_ROW_GROUP_EL,
387             th => TABLE_CELL_EL,
388             thead => TABLE_ROW_GROUP_EL,
389             title => MISC_SPECIAL_EL,
390             tr => TABLE_ROW_EL,
391             tt => FORMATTING_EL,
392             u => FORMATTING_EL,
393             ul => MISC_SPECIAL_EL,
394             wbr => MISC_SPECIAL_EL,
395             xmp => MISC_SPECIAL_EL,
396             };
397              
398             my $el_category_f = {
399             (MML_NS) => {
400             'annotation-xml' => MML_AXML_EL,
401             mi => MML_TEXT_INTEGRATION_EL,
402             mo => MML_TEXT_INTEGRATION_EL,
403             mn => MML_TEXT_INTEGRATION_EL,
404             ms => MML_TEXT_INTEGRATION_EL,
405             mtext => MML_TEXT_INTEGRATION_EL,
406             },
407             (SVG_NS) => {
408             foreignObject => SVG_INTEGRATION_EL,
409             desc => SVG_INTEGRATION_EL,
410             title => SVG_INTEGRATION_EL,
411             script => SVG_SCRIPT_EL,
412             },
413             ## NOTE: In addition, FOREIGN_EL is set to non-HTML elements, MML_EL
414             ## is set to MathML elements, and SVG_EL is set to SVG elements.
415             };
416              
417             my $svg_attr_name = {
418             attributename => 'attributeName',
419             attributetype => 'attributeType',
420             basefrequency => 'baseFrequency',
421             baseprofile => 'baseProfile',
422             calcmode => 'calcMode',
423             clippathunits => 'clipPathUnits',
424             contentscripttype => 'contentScriptType',
425             contentstyletype => 'contentStyleType',
426             diffuseconstant => 'diffuseConstant',
427             edgemode => 'edgeMode',
428             externalresourcesrequired => 'externalResourcesRequired',
429             filterres => 'filterRes',
430             filterunits => 'filterUnits',
431             glyphref => 'glyphRef',
432             gradienttransform => 'gradientTransform',
433             gradientunits => 'gradientUnits',
434             kernelmatrix => 'kernelMatrix',
435             kernelunitlength => 'kernelUnitLength',
436             keypoints => 'keyPoints',
437             keysplines => 'keySplines',
438             keytimes => 'keyTimes',
439             lengthadjust => 'lengthAdjust',
440             limitingconeangle => 'limitingConeAngle',
441             markerheight => 'markerHeight',
442             markerunits => 'markerUnits',
443             markerwidth => 'markerWidth',
444             maskcontentunits => 'maskContentUnits',
445             maskunits => 'maskUnits',
446             numoctaves => 'numOctaves',
447             pathlength => 'pathLength',
448             patterncontentunits => 'patternContentUnits',
449             patterntransform => 'patternTransform',
450             patternunits => 'patternUnits',
451             pointsatx => 'pointsAtX',
452             pointsaty => 'pointsAtY',
453             pointsatz => 'pointsAtZ',
454             preservealpha => 'preserveAlpha',
455             preserveaspectratio => 'preserveAspectRatio',
456             primitiveunits => 'primitiveUnits',
457             refx => 'refX',
458             refy => 'refY',
459             repeatcount => 'repeatCount',
460             repeatdur => 'repeatDur',
461             requiredextensions => 'requiredExtensions',
462             requiredfeatures => 'requiredFeatures',
463             specularconstant => 'specularConstant',
464             specularexponent => 'specularExponent',
465             spreadmethod => 'spreadMethod',
466             startoffset => 'startOffset',
467             stddeviation => 'stdDeviation',
468             stitchtiles => 'stitchTiles',
469             surfacescale => 'surfaceScale',
470             systemlanguage => 'systemLanguage',
471             tablevalues => 'tableValues',
472             targetx => 'targetX',
473             targety => 'targetY',
474             textlength => 'textLength',
475             viewbox => 'viewBox',
476             viewtarget => 'viewTarget',
477             xchannelselector => 'xChannelSelector',
478             ychannelselector => 'yChannelSelector',
479             zoomandpan => 'zoomAndPan',
480             };
481              
482             my $foreign_attr_xname = {
483             'xlink:actuate' => [(XLINK_NS), ['xlink', 'actuate']],
484             'xlink:arcrole' => [(XLINK_NS), ['xlink', 'arcrole']],
485             'xlink:href' => [(XLINK_NS), ['xlink', 'href']],
486             'xlink:role' => [(XLINK_NS), ['xlink', 'role']],
487             'xlink:show' => [(XLINK_NS), ['xlink', 'show']],
488             'xlink:title' => [(XLINK_NS), ['xlink', 'title']],
489             'xlink:type' => [(XLINK_NS), ['xlink', 'type']],
490             'xml:base' => [(XML_NS), ['xml', 'base']],
491             'xml:lang' => [(XML_NS), ['xml', 'lang']],
492             'xml:space' => [(XML_NS), ['xml', 'space']],
493             'xmlns' => [(XMLNS_NS), [undef, 'xmlns']],
494             'xmlns:xlink' => [(XMLNS_NS), ['xmlns', 'xlink']],
495             };
496              
497             ## TODO: Invoke the reset algorithm when a resettable element is
498             ## created (cf. HTML5 revision 2259).
499              
500             sub parse_byte_string ($$$$;$) {
501 708     708 0 1310 my $self = shift;
502 708         1678 my $charset_name = shift;
503 708 50   9   11713 open my $input, '<', ref $_[0] ? $_[0] : \($_[0]);
  9         88  
  9         26  
  9         140  
504 708         11606 return $self->parse_byte_stream ($charset_name, $input, @_[1..$#_]);
505             } # parse_byte_string
506              
507             sub parse_byte_stream ($$$$;$$) {
508             # my ($self, $charset_name, $byte_stream, $doc, $onerror, $get_wrapper) = @_;
509 708 50   708 0 2004 my $self = ref $_[0] ? shift : shift->new;
510 708         1445 my $charset_name = shift;
511 708         1104 my $byte_stream = $_[0];
512              
513             my $onerror = $_[2] || sub {
514 0     0   0 my (%opt) = @_;
515 0         0 warn "Parse error ($opt{type})\n";
516 708   50     1934 };
517 708         2566 $self->{parse_error} = $onerror; # updated later by parse_char_string
518              
519             my $get_wrapper = $_[3] || sub ($) {
520 711     711   1418 return $_[0]; # $_[0] = byte stream handle, returned = arg to char handle
521 708   50     3827 };
522              
523             ## HTML5 encoding sniffing algorithm
524 708         10587 require HTML::HTML5::Parser::Charset::Info;
525 708         2359 my $charset;
526             my $buffer;
527 708         0 my ($char_stream, $e_status);
528              
529             SNIFFING: {
530             ## NOTE: By setting |allow_fallback| option true when the
531             ## |get_decode_handle| method is invoked, we ignore what the HTML5
532             ## spec requires, i.e. unsupported encoding should be ignored.
533             ## TODO: We should not do this unless the parser is invoked
534             ## in the conformance checking mode, in which this behavior
535             ## would be useful.
536              
537             ## Step 1
538 708 50       1705 if (defined $charset_name) {
  708         1957  
539 0         0 $charset = HTML::HTML5::Parser::Charset::Info->get_by_html_name ($charset_name);
540             ## TODO: Is this ok? Transfer protocol's parameter should be
541             ## interpreted in its semantics?
542              
543 0         0 ($char_stream, $e_status) = $charset->get_decode_handle
544             ($byte_stream, allow_error_reporting => 1,
545             allow_fallback => 1);
546 0 0       0 if ($char_stream) {
547 0         0 $self->{confident} = 1;
548 0         0 last SNIFFING;
549             } else {
550             $self->{parse_error}->(level => $self->{level}->{must}, type => 'charset:not supported',
551             layer => 'encode',
552             line => 1, column => 1,
553             value => $charset_name,
554 0         0 level => $self->{level}->{uncertain});
555             }
556             }
557              
558             ## Step 2
559 708         1528 my $byte_buffer = '';
560 708         2341 for (1..1024) {
561 29516         53723 my $char = $byte_stream->getc;
562 29516 100       142567 last unless defined $char;
563 28808         46108 $byte_buffer .= $char;
564             } ## TODO: timeout
565              
566             ## Step 3
567 708 50       3496 if ($byte_buffer =~ /^\xFE\xFF/) {
    50          
    50          
568 0         0 $charset = HTML::HTML5::Parser::Charset::Info->get_by_html_name ('utf-16be');
569 0         0 ($char_stream, $e_status) = $charset->get_decode_handle
570             ($byte_stream, allow_error_reporting => 1,
571             allow_fallback => 1, byte_buffer => \$byte_buffer);
572 0         0 $self->{confident} = 1;
573 0         0 last SNIFFING;
574             } elsif ($byte_buffer =~ /^\xFF\xFE/) {
575 0         0 $charset = HTML::HTML5::Parser::Charset::Info->get_by_html_name ('utf-16le');
576 0         0 ($char_stream, $e_status) = $charset->get_decode_handle
577             ($byte_stream, allow_error_reporting => 1,
578             allow_fallback => 1, byte_buffer => \$byte_buffer);
579 0         0 $self->{confident} = 1;
580 0         0 last SNIFFING;
581             } elsif ($byte_buffer =~ /^\xEF\xBB\xBF/) {
582 0         0 $charset = HTML::HTML5::Parser::Charset::Info->get_by_html_name ('utf-8');
583 0         0 ($char_stream, $e_status) = $charset->get_decode_handle
584             ($byte_stream, allow_error_reporting => 1,
585             allow_fallback => 1, byte_buffer => \$byte_buffer);
586 0         0 $self->{confident} = 1;
587 0         0 last SNIFFING;
588             }
589              
590             ## Step 4
591             ## TODO:
592              
593             ## Step 5
594             ## TODO: from history
595              
596             ## Step 6
597 708         8485 require HTML::HTML5::Parser::Charset::UniversalCharDet;
598 708 50       5299 $charset_name = HTML::HTML5::Parser::Charset::UniversalCharDet->detect_byte_string($byte_buffer)
599             if $byte_buffer;
600 708 50       1775 if (defined $charset_name) {
601 708         3579 $charset = HTML::HTML5::Parser::Charset::Info->get_by_html_name ($charset_name);
602              
603 708         9112 require HTML::HTML5::Parser::Charset::DecodeHandle;
604 708         4730 $buffer = HTML::HTML5::Parser::Charset::DecodeHandle::ByteBuffer->new
605             ($byte_stream);
606 708         2630 ($char_stream, $e_status) = $charset->get_decode_handle
607             ($buffer, allow_error_reporting => 1,
608             allow_fallback => 1, byte_buffer => \$byte_buffer);
609 708 50       1853 if ($char_stream) {
610 708         1719 $buffer->{buffer} = $byte_buffer;
611             $self->{parse_error}->(level => $self->{level}->{must}, type => 'sniffing:chardet',
612             text => $charset_name,
613             level => $self->{level}->{info},
614 708         3338 layer => 'encode',
615             line => 1, column => 1);
616 708         1467 $self->{confident} = 0;
617 708         1619 last SNIFFING;
618             }
619             }
620              
621             ## Step 7: default
622             ## TODO: Make this configurable.
623 0         0 $charset = HTML::HTML5::Parser::Charset::Info->get_by_html_name ('windows-1252');
624             ## NOTE: We choose |windows-1252| here, since |utf-8| should be
625             ## detectable in the step 6.
626 0         0 require HTML::HTML5::Parser::Charset::DecodeHandle;
627 0         0 $buffer = HTML::HTML5::Parser::Charset::DecodeHandle::ByteBuffer->new
628             ($byte_stream);
629 0         0 ($char_stream, $e_status)
630             = $charset->get_decode_handle ($buffer,
631             allow_error_reporting => 1,
632             allow_fallback => 1,
633             byte_buffer => \$byte_buffer);
634 0         0 $buffer->{buffer} = $byte_buffer;
635             $self->{parse_error}->(level => $self->{level}->{must}, type => 'sniffing:default',
636             text => 'windows-1252',
637             level => $self->{level}->{info},
638 0         0 line => 1, column => 1,
639             layer => 'encode');
640 0         0 $self->{confident} = 0;
641             } # SNIFFING
642              
643 708 50       2989 if ($e_status & HTML::HTML5::Parser::Charset::Info::FALLBACK_ENCODING_IMPL ()) {
    50          
644 0         0 $self->{input_encoding} = $charset->get_iana_name; ## TODO: Should we set actual charset decoder's encoding name?
645             $self->{parse_error}->(level => $self->{level}->{must}, type => 'chardecode:fallback',
646             #text => $self->{input_encoding},
647             level => $self->{level}->{uncertain},
648 0         0 line => 1, column => 1,
649             layer => 'encode');
650             } elsif (not ($e_status &
651             HTML::HTML5::Parser::Charset::Info::ERROR_REPORTING_ENCODING_IMPL ())) {
652 0         0 $self->{input_encoding} = $charset->get_iana_name;
653             $self->{parse_error}->(level => $self->{level}->{must}, type => 'chardecode:no error',
654             text => $self->{input_encoding},
655             level => $self->{level}->{uncertain},
656 0         0 line => 1, column => 1,
657             layer => 'encode');
658             } else {
659 708         2298 $self->{input_encoding} = $charset->get_iana_name;
660             }
661              
662             $self->{change_encoding} = sub {
663 5     5   12 my $self = shift;
664 5         14 $charset_name = shift;
665 5         18 my $token = shift;
666 5         10 my $orig_char_stream = $char_stream;
667              
668 5         25 $charset = HTML::HTML5::Parser::Charset::Info->get_by_html_name ($charset_name);
669             ($char_stream, $e_status) = $charset->get_decode_handle
670             ($byte_stream, allow_error_reporting => 1, allow_fallback => 1,
671 5         21 byte_buffer => \ $buffer->{buffer});
672            
673 5 50       16 if ($char_stream) { # if supported
674 5 50 33     26 if ($charset->{category} & HTML::HTML5::Parser::Charset::Info::CHARSET_CATEGORY_ASCII_COMPAT () or
675             $charset->{category} & HTML::HTML5::Parser::Charset::Info::CHARSET_CATEGORY_UTF16 ()) {
676             #
677             } else {
678 0         0 return;
679             }
680            
681             ## "Change the encoding" algorithm:
682            
683             ## Step 1
684 5 100 66     34 if (defined $self->{input_encoding} and
685             $self->{input_encoding} eq $charset_name) {
686             $self->{parse_error}->(level => $self->{level}->{must}, type => 'charset label:matching',
687             text => $charset_name,
688 2         11 level => $self->{level}->{info});
689 2         5 $self->{confident} = 1;
690 2         4 return;
691             }
692              
693             ## Step 2 (HTML5 revision 3205)
694 3 50 33     16 if (defined $self->{input_encoding} and
695             HTML::HTML5::Parser::Charset::Info->get_by_html_name ($self->{input_encoding})
696             ->{category} & HTML::HTML5::Parser::Charset::Info::CHARSET_CATEGORY_UTF16 ()) {
697 0         0 $self->{confident} = 1;
698 0         0 return;
699             }
700              
701             ## Step 3
702 3 50       10 if ($charset->{category} &
703             HTML::HTML5::Parser::Charset::Info::CHARSET_CATEGORY_UTF16 ()) {
704 0         0 $charset = HTML::HTML5::Parser::Charset::Info->get_by_html_name ('utf-8');
705             ($char_stream, $e_status) = $charset->get_decode_handle
706             ($byte_stream,
707             allow_error_reporting => 1,
708 0         0 byte_buffer => \ $buffer->{buffer});
709             }
710 3         10 $charset_name = $charset->get_iana_name;
711              
712             $self->{parse_error}->(level => $self->{level}->{must}, type => 'charset label detected',
713             text => $self->{input_encoding},
714             value => $charset_name,
715             level => $self->{level}->{warn},
716 3         14 token => $token);
717            
718             ## Step 4
719             # if (can) {
720             ## change the encoding on the fly.
721             #$self->{confident} = 1;
722             #return;
723             # }
724            
725             ## Step 5
726 3         24 HTML::HTML5::Parser::TagSoupParser::RestartParser->throw;
727             } else {
728 0         0 $char_stream = $orig_char_stream;
729             }
730 708         6337 }; # $self->{change_encoding}
731              
732             # XXX IF YOU PUT $SELF IN HERE YOU GET HUGE FAT MEMORY LEAKS
733             my %x = (
734             level => $self->{level}{must},
735             layer => 'encode',
736             line => $self->{line},
737             column => $self->{column} + 1,
738             error => $self->{parse_error},
739 708         4662 );
740             my $char_onerror = sub {
741 0     0   0 my (undef, $type, %opt) = @_;
742             $x{error}->(
743             level => $x{level}, layer => $x{layer},
744             line => $x{line}, column => $x{column},
745 0         0 %opt, type => $type);
746 0 0       0 if ($opt{octets}) {
747 0         0 ${$opt{octets}} = "\x{FFFD}"; # relacement character
  0         0  
748             }
749 708         3583 };
750              
751 708         2145 my $wrapped_char_stream = $get_wrapper->($char_stream);
752 708         2929 $wrapped_char_stream->onerror ($char_onerror);
753              
754 708         1535 my @args = ($_[1], $_[2]); # $doc, $onerror - $get_wrapper = undef;
755 708         1216 my $return;
756             try {
757 708     708   38168 $return = $self->parse_char_stream ($wrapped_char_stream, @args);
758             }
759             ## NOTE: Invoked after {change_encoding}.
760             catch {
761 3 50 33 3   168 unless (blessed($_)
762             and $_->isa('HTML::HTML5::Parser::TagSoupParser::RestartParser'))
763             {
764 0         0 die $_;
765             }
766            
767 3 50       18 if ($e_status & HTML::HTML5::Parser::Charset::Info::FALLBACK_ENCODING_IMPL ()) {
    50          
768 0         0 $self->{input_encoding} = $charset->get_iana_name; ## TODO: Should we set actual charset decoder's encoding name?
769             $self->{parse_error}->(level => $self->{level}->{must}, type => 'chardecode:fallback',
770             level => $self->{level}->{uncertain},
771             #text => $self->{input_encoding},
772 0         0 line => 1, column => 1,
773             layer => 'encode');
774             } elsif (not ($e_status &
775             HTML::HTML5::Parser::Charset::Info::ERROR_REPORTING_ENCODING_IMPL ())) {
776 0         0 $self->{input_encoding} = $charset->get_iana_name;
777             $self->{parse_error}->(level => $self->{level}->{must}, type => 'chardecode:no error',
778             text => $self->{input_encoding},
779             level => $self->{level}->{uncertain},
780 0         0 line => 1, column => 1,
781             layer => 'encode');
782             } else {
783 3         10 $self->{input_encoding} = $charset->get_iana_name;
784             }
785 3         7 $self->{confident} = 1;
786              
787 3         7 $wrapped_char_stream = $get_wrapper->($char_stream);
788 3         12 $wrapped_char_stream->onerror ($char_onerror);
789              
790 3         8 $return = $self->parse_char_stream ($wrapped_char_stream, @args);
791 708         6520 };
792 708         15346 $self->_data($return, charset => $charset_name);
793 708         4054 return $return;
794             } # parse_byte_stream
795              
796             ## NOTE: HTML5 spec says that the encoding layer MUST NOT strip BOM
797             ## and the HTML layer MUST ignore it. However, we does strip BOM in
798             ## the encoding layer and the HTML layer does not ignore any U+FEFF,
799             ## because the core part of our HTML parser expects a string of character,
800             ## not a string of bytes or code units or anything which might contain a BOM.
801             ## Therefore, any parser interface that accepts a string of bytes,
802             ## such as |parse_byte_string| in this module, must ensure that it does
803             ## strip the BOM and never strip any ZWNBSP.
804              
805             sub parse_char_string ($$$;$$) {
806             #my ($self, $s, $doc, $onerror, $get_wrapper) = @_;
807 0     0 0 0 my $self = shift;
808 0 0       0 my $s = ref $_[0] ? $_[0] : \($_[0]);
809 0         0 require HTML::HTML5::Parser::Charset::DecodeHandle;
810 0         0 my $input = HTML::HTML5::Parser::Charset::DecodeHandle::CharString->new ($s);
811 0         0 return $self->parse_char_stream ($input, @_[1..$#_]);
812             } # parse_char_string
813             *parse_string = \&parse_char_string; ## NOTE: Alias for backward compatibility.
814              
815             sub parse_char_stream ($$$;$$) {
816 711 50   711 0 1943 my $self = ref $_[0] ? shift : shift->new;
817 711         1101 my $input = $_[0];
818 711         1663 my $doc = $self->{document} = $_[1];
819 711         5850 $self->{document}->removeChildNodes;
820              
821             ## NOTE: |set_inner_html| copies most of this method's code
822              
823             ## Confidence: irrelevant.
824 711 50       2177 $self->{confident} = 1 unless exists $self->{confident};
825              
826             $self->{document}->setEncoding($self->{input_encoding})
827 711 50       3884 if defined $self->{input_encoding};
828             ## TODO: |{input_encoding}| is needless?
829              
830 711         1813 $self->{line_prev} = $self->{line} = 1;
831 711         1426 $self->{column_prev} = -1;
832 711         1333 $self->{column} = 0;
833             $self->{set_nc} = sub {
834 1678     1678   3229 my $self = shift;
835              
836 1678         2975 my $char = '';
837 1678 50       3933 if (defined $self->{next_nc}) {
838 0         0 $char = $self->{next_nc};
839 0         0 delete $self->{next_nc};
840 0         0 $self->{nc} = ord $char;
841             } else {
842 1678         3429 $self->{char_buffer} = '';
843 1678         2662 $self->{char_buffer_pos} = 0;
844              
845             my $count = $input->manakai_read_until
846 1678         10437 ($self->{char_buffer}, qr/[^\x0A\x0D]/, $self->{char_buffer_pos});
847 1678 100       5547 if ($count) {
848 832         1727 $self->{line_prev} = $self->{line};
849 832         1407 $self->{column_prev} = $self->{column};
850 832         1299 $self->{column}++;
851             $self->{nc}
852 832         2272 = ord substr ($self->{char_buffer}, $self->{char_buffer_pos}++, 1);
853 832         2453 return;
854             }
855              
856 846 100       2339 if ($input->read ($char, 1)) {
857 135         340 $self->{nc} = ord $char;
858             } else {
859 711         1507 $self->{nc} = -1;
860 711         1819 return;
861             }
862             }
863              
864             ($self->{line_prev}, $self->{column_prev})
865 135         717 = ($self->{line}, $self->{column});
866 135         241 $self->{column}++;
867            
868 135 50       313 if ($self->{nc} == 0x000A) { # LF
    0          
869            
870 135         211 $self->{line}++;
871 135         370 $self->{column} = 0;
872             } elsif ($self->{nc} == 0x000D) { # CR
873            
874             ## TODO: support for abort/streaming
875 0         0 my $next = '';
876 0 0 0     0 if ($input->read ($next, 1) and $next ne "\x0A") {
877 0         0 $self->{next_nc} = $next;
878             }
879 0         0 $self->{nc} = 0x000A; # LF # MUST
880 0         0 $self->{line}++;
881 0         0 $self->{column} = 0;
882             }
883 711         6294 };
884              
885             $self->{read_until} = sub {
886             #my ($scalar, $specials_range, $offset) = @_;
887 1125 50   1125   3141 return 0 if defined $self->{next_nc};
888              
889 1125         12063 my $pattern = qr/[^$_[1]\x0A\x0D]/;
890 1125   100     3375 my $offset = $_[2] || 0;
891              
892 1125 100       3191 if ($self->{char_buffer_pos} < length $self->{char_buffer}) {
893 909         3084 pos ($self->{char_buffer}) = $self->{char_buffer_pos};
894 909 100       12564 if ($self->{char_buffer} =~ /\G(?>$pattern)+/) {
895             substr ($_[0], $offset)
896 671         4117 = substr ($self->{char_buffer}, $-[0], $+[0] - $-[0]);
897 671         2295 my $count = $+[0] - $-[0];
898 671 50       1831 if ($count) {
899 671         1267 $self->{column} += $count;
900 671         1128 $self->{char_buffer_pos} += $count;
901 671         1182 $self->{line_prev} = $self->{line};
902 671         1293 $self->{column_prev} = $self->{column} - 1;
903 671         1098 $self->{nc} = -1;
904             }
905 671         2596 return $count;
906             } else {
907 238         1060 return 0;
908             }
909             } else {
910 216         866 my $count = $input->manakai_read_until ($_[0], $pattern, $_[2]);
911 216 100       595 if ($count) {
912 51         110 $self->{column} += $count;
913 51         91 $self->{line_prev} = $self->{line};
914 51         112 $self->{column_prev} = $self->{column} - 1;
915 51         102 $self->{nc} = -1;
916             }
917 216         817 return $count;
918             }
919 711         4038 }; # $self->{read_until}
920              
921             my $onerror = $_[2] || sub {
922 0     0   0 my (%opt) = @_;
923 0 0       0 my $line = $opt{token} ? $opt{token}->{line} : $opt{line};
924 0 0       0 my $column = $opt{token} ? $opt{token}->{column} : $opt{column};
925 0         0 warn "Parse error ($opt{type}) at line $line column $column\n";
926 711   50     2047 };
927             $self->{parse_error} = sub {
928 1439     1439   5400 $onerror->(line => $self->{line}, column => $self->{column}, @_);
929 711         2922 };
930              
931             my $char_onerror = sub {
932 0     0   0 my (undef, $type, %opt) = @_;
933             $self->{parse_error}->(level => $self->{level}->{must}, layer => 'encode',
934 0         0 line => $self->{line}, column => $self->{column} + 1,
935             %opt, type => $type);
936 711         3519 }; # $char_onerror
937              
938 711 50       1900 if ($_[3]) {
939 0         0 $input = $_[3]->($input);
940 0         0 $input->onerror ($char_onerror);
941             } else {
942 711 50       2636 $input->onerror ($char_onerror) unless defined $input->onerror;
943             }
944              
945 711         2881 $self->_initialize_tokenizer;
946 711         2633 $self->_initialize_tree_constructor;
947 711         2244 $self->_construct_tree;
948 708         2492 $self->_terminate_tree_constructor;
949              
950             ## Remove self-references
951 708         7260 delete $self->{set_nc};
952 708         6056 delete $self->{read_until};
953 708         2049 delete $self->{parse_error};
954 708         1222 delete $self->{document};
955              
956 708         3786 return $doc;
957             } # parse_char_stream
958              
959             sub new ($;@) {
960 705     705 0 1420 my $class = shift;
961 705         1293 my %p = @_;
962             my $self = bless {
963             level => {
964             must => 'm',
965             should => 's',
966             obsconforming => 's',
967             warn => 'w',
968             info => 'i',
969             uncertain => 'u',
970             },
971 705 50       6336 _debug_cache => $p{no_cache} ? {} : $DATA,
972             }, $class;
973             $self->{set_nc} = sub {
974 0     0   0 $self->{nc} = -1;
975 705         3674 };
976       0     $self->{parse_error} = sub {
977             #
978 705         2323 };
979       0     $self->{change_encoding} = sub {
980             # if ($_[0] is a supported encoding) {
981             # run "change the encoding" algorithm;
982             # throw Whatpm::HTML::RestartParser (charset => $new_encoding);
983             # }
984 705         2223 };
985       884     $self->{application_cache_selection} = sub {
986             #
987 705         1846 };
988 705         2944 return $self;
989             } # new
990              
991             ## Insertion modes
992              
993             sub AFTER_HTML_IMS () { 0b100 }
994             sub HEAD_IMS () { 0b1000 }
995             sub BODY_IMS () { 0b10000 }
996             sub BODY_TABLE_IMS () { 0b100000 }
997             sub TABLE_IMS () { 0b1000000 }
998             sub ROW_IMS () { 0b10000000 }
999             sub BODY_AFTER_IMS () { 0b100000000 }
1000             sub FRAME_IMS () { 0b1000000000 }
1001             sub SELECT_IMS () { 0b10000000000 }
1002             sub IN_CDATA_RCDATA_IM () { 0b1000000000000 }
1003             ## NOTE: "in CDATA/RCDATA" insertion mode is also special; it is
1004             ## combined with the original insertion mode. In thie parser,
1005             ## they are stored together in the bit-or'ed form.
1006              
1007             sub IM_MASK () { 0b11111111111 }
1008              
1009             ## NOTE: "initial" and "before html" insertion modes have no constants.
1010              
1011             ## NOTE: "after after body" insertion mode.
1012             sub AFTER_HTML_BODY_IM () { AFTER_HTML_IMS | BODY_AFTER_IMS }
1013              
1014             ## NOTE: "after after frameset" insertion mode.
1015             sub AFTER_HTML_FRAMESET_IM () { AFTER_HTML_IMS | FRAME_IMS }
1016              
1017             sub IN_HEAD_IM () { HEAD_IMS | 0b00 }
1018             sub IN_HEAD_NOSCRIPT_IM () { HEAD_IMS | 0b01 }
1019             sub AFTER_HEAD_IM () { HEAD_IMS | 0b10 }
1020             sub BEFORE_HEAD_IM () { HEAD_IMS | 0b11 }
1021             sub IN_BODY_IM () { BODY_IMS }
1022             sub IN_CELL_IM () { BODY_IMS | BODY_TABLE_IMS | 0b01 }
1023             sub IN_CAPTION_IM () { BODY_IMS | BODY_TABLE_IMS | 0b10 }
1024             sub IN_ROW_IM () { TABLE_IMS | ROW_IMS | 0b01 }
1025             sub IN_TABLE_BODY_IM () { TABLE_IMS | ROW_IMS | 0b10 }
1026             sub IN_TABLE_IM () { TABLE_IMS }
1027             sub AFTER_BODY_IM () { BODY_AFTER_IMS }
1028             sub IN_FRAMESET_IM () { FRAME_IMS | 0b01 }
1029             sub AFTER_FRAMESET_IM () { FRAME_IMS | 0b10 }
1030             sub IN_SELECT_IM () { SELECT_IMS | 0b01 }
1031             sub IN_SELECT_IN_TABLE_IM () { SELECT_IMS | 0b10 }
1032             sub IN_COLUMN_GROUP_IM () { 0b10 }
1033              
1034             sub _initialize_tree_constructor ($) {
1035 711     711   1294 my $self = shift;
1036             ## NOTE: $self->{document} MUST be specified before this method is called
1037 711         2120 $self->_data($self->{document})->{strict_error_checking} = 0;
1038             ## TODO: Turn mutation events off # MUST
1039             ## TODO: Turn loose Document option (manakai extension) on
1040 711         1717 $self->_data($self->{document})->{manakai_is_html} = 1; # MUST
1041 711         1574 $self->_data($self->{document})->{manakai_source_line} = 1;
1042 711         1674 $self->_data($self->{document})->{manakai_source_column} = 1;
1043              
1044 711         1373 $self->{frameset_ok} = 1;
1045             } # _initialize_tree_constructor
1046              
1047             sub _terminate_tree_constructor ($) {
1048 708     708   1370 my $self = shift;
1049 708         2340 $self->_data($self->{document}, strict_error_checking => 1);
1050             ## TODO: Turn mutation events on
1051             } # _terminate_tree_constructor
1052              
1053             ## ISSUE: Should appendChild (for example) in script executed in tree construction stage fire mutation events?
1054              
1055             { # tree construction stage
1056             my $token;
1057              
1058             sub _construct_tree ($) {
1059 711     711   1348 my ($self) = @_;
1060              
1061             ## When an interactive UA render the $self->{document} available
1062             ## to the user, or when it begin accepting user input, are
1063             ## not defined.
1064            
1065 711         1453 $self->{insertion_mode} = 0; # dummy
1066 711         2138 $token = $self->_get_next_token;
1067              
1068 711         1536 undef $self->{form_element};
1069 711         1318 undef $self->{head_element};
1070 711         1532 $self->{open_elements} = [];
1071 711         1572 undef $self->{inner_html_node};
1072 711         1462 undef $self->{ignore_newline};
1073              
1074             ## NOTE: The "initial" insertion mode.
1075 711         2835 $self->_tree_construction_initial; # MUST
1076              
1077             ## NOTE: The "before html" insertion mode.
1078 711         2826 $self->_tree_construction_root_element;
1079 711         1218 $self->{insertion_mode} = BEFORE_HEAD_IM;
1080              
1081             ## NOTE: The "before head" insertion mode and so on.
1082 711         1916 $self->_tree_construction_main;
1083             } # _construct_tree
1084              
1085             sub _tree_construction_initial ($) {
1086 711     711   1250 my $self = shift;
1087              
1088             ## NOTE: "initial" insertion mode
1089              
1090             INITIAL: {
1091 711 100       1184 if ($token->{type} == DOCTYPE_TOKEN) {
  722 100       2948  
    100          
    50          
1092             ## NOTE: Conformance checkers MAY, instead of reporting "not
1093             ## HTML5" error, switch to a conformance checking mode for
1094             ## another language. (We don't support such mode switchings; it
1095             ## is nonsense to do anything different from what browsers do.)
1096 392         781 my $doctype_name = $token->{name};
1097 392 100       997 $doctype_name = '' unless defined $doctype_name;
1098              
1099 392 100       1521 if ($doctype_name ne 'html') {
    100          
    100          
1100            
1101 26         93 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not HTML5', token => $token);
1102             } elsif (defined $token->{pubid}) {
1103             ## Obsolete permitted DOCTYPEs (case-sensitive)
1104             my $xsysid = {
1105             '-//W3C//DTD HTML 4.0//EN' => 'http://www.w3.org/TR/REC-html40/strict.dtd',
1106             '-//W3C//DTD HTML 4.01//EN' => 'http://www.w3.org/TR/html4/strict.dtd',
1107             '-//W3C//DTD XHTML 1.0 Strict//EN' => 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd',
1108             '-//W3C//DTD XHTML 1.1//EN' => 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd',
1109 9         55 }->{$token->{pubid}};
1110 9 100 33     62 if (defined $xsysid and
      66        
1111             (not defined $token->{sysid} or $token->{sysid} eq $xsysid)) {
1112            
1113             $self->{parse_error}->(level => $self->{level}->{must}, type => 'obs DOCTYPE', token => $token,
1114 5         20 level => $self->{level}->{obsconforming});
1115             } else {
1116            
1117 4         18 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not HTML5', token => $token);
1118             }
1119             } elsif (defined $token->{sysid}) {
1120 2 50       20 if ($token->{sysid} eq 'about:legacy-compat') {
1121             ##
1122             $self->{parse_error}->(level => $self->{level}->{must}, type => 'XSLT-compat', token => $token,
1123 0         0 level => $self->{level}->{should});
1124             } else {
1125 2         23 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not HTML5', token => $token);
1126             }
1127             } else { ##
1128            
1129             #
1130             }
1131            
1132 392         1781 $self->_data($self->{'document'}, 'DTD_PUBLIC_ID', $token->{pubid});
1133 392         1676 $self->_data($self->{'document'}, 'DTD_SYSTEM_ID', $token->{sysid});
1134 392 100       1819 $self->_data($self->{'document'}, 'DTD_ELEMENT', (defined $token->{name}?$token->{name}:''));
1135 392         1119 $self->_data($self->{'document'}, 'DTD_COLUMN', $token->{column});
1136 392         1340 $self->_data($self->{'document'}, 'DTD_LINE', $token->{line});
1137              
1138             # TOBYINK
1139             $self->_data($self->{'document'}, isHTML4 => 1)
1140 392 100 100     2843 if (($token->{pubid}||'') =~ /html 4/i or ($token->{sysid}||'') =~ /html4/i);
      100        
      100        
1141              
1142 392 100 100     1919 if ($token->{quirks} or $doctype_name ne 'html') {
    100          
1143            
1144 26         66 $self->_data($self->{document})->{'manakai_compat_mode'} = 'quirks';
1145             } elsif (defined $token->{pubid}) {
1146 9         405 my $pubid = $token->{pubid};
1147 9         31 $pubid =~ tr/a-z/A-Z/; ## ASCII case-insensitive.
1148 9         119 my $prefix = [
1149             "+//SILMARIL//DTD HTML PRO V0R11 19970101//",
1150             "-//ADVASOFT LTD//DTD HTML 3.0 ASWEDIT + EXTENSIONS//",
1151             "-//AS//DTD HTML 3.0 ASWEDIT + EXTENSIONS//",
1152             "-//IETF//DTD HTML 2.0 LEVEL 1//",
1153             "-//IETF//DTD HTML 2.0 LEVEL 2//",
1154             "-//IETF//DTD HTML 2.0 STRICT LEVEL 1//",
1155             "-//IETF//DTD HTML 2.0 STRICT LEVEL 2//",
1156             "-//IETF//DTD HTML 2.0 STRICT//",
1157             "-//IETF//DTD HTML 2.0//",
1158             "-//IETF//DTD HTML 2.1E//",
1159             "-//IETF//DTD HTML 3.0//",
1160             "-//IETF//DTD HTML 3.2 FINAL//",
1161             "-//IETF//DTD HTML 3.2//",
1162             "-//IETF//DTD HTML 3//",
1163             "-//IETF//DTD HTML LEVEL 0//",
1164             "-//IETF//DTD HTML LEVEL 1//",
1165             "-//IETF//DTD HTML LEVEL 2//",
1166             "-//IETF//DTD HTML LEVEL 3//",
1167             "-//IETF//DTD HTML STRICT LEVEL 0//",
1168             "-//IETF//DTD HTML STRICT LEVEL 1//",
1169             "-//IETF//DTD HTML STRICT LEVEL 2//",
1170             "-//IETF//DTD HTML STRICT LEVEL 3//",
1171             "-//IETF//DTD HTML STRICT//",
1172             "-//IETF//DTD HTML//",
1173             "-//METRIUS//DTD METRIUS PRESENTATIONAL//",
1174             "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML STRICT//",
1175             "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML//",
1176             "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 TABLES//",
1177             "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML STRICT//",
1178             "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML//",
1179             "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 TABLES//",
1180             "-//NETSCAPE COMM. CORP.//DTD HTML//",
1181             "-//NETSCAPE COMM. CORP.//DTD STRICT HTML//",
1182             "-//O'REILLY AND ASSOCIATES//DTD HTML 2.0//",
1183             "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED 1.0//",
1184             "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED RELAXED 1.0//",
1185             "-//SOFTQUAD SOFTWARE//DTD HOTMETAL PRO 6.0::19990601::EXTENSIONS TO HTML 4.0//",
1186             "-//SOFTQUAD//DTD HOTMETAL PRO 4.0::19971010::EXTENSIONS TO HTML 4.0//",
1187             "-//SPYGLASS//DTD HTML 2.0 EXTENDED//",
1188             "-//SQ//DTD HTML 2.0 HOTMETAL + EXTENSIONS//",
1189             "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA HTML//",
1190             "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA STRICT HTML//",
1191             "-//W3C//DTD HTML 3 1995-03-24//",
1192             "-//W3C//DTD HTML 3.2 DRAFT//",
1193             "-//W3C//DTD HTML 3.2 FINAL//",
1194             "-//W3C//DTD HTML 3.2//",
1195             "-//W3C//DTD HTML 3.2S DRAFT//",
1196             "-//W3C//DTD HTML 4.0 FRAMESET//",
1197             "-//W3C//DTD HTML 4.0 TRANSITIONAL//",
1198             "-//W3C//DTD HTML EXPERIMETNAL 19960712//",
1199             "-//W3C//DTD HTML EXPERIMENTAL 970421//",
1200             "-//W3C//DTD W3 HTML//",
1201             "-//W3O//DTD W3 HTML 3.0//",
1202             "-//WEBTECHS//DTD MOZILLA HTML 2.0//",
1203             "-//WEBTECHS//DTD MOZILLA HTML//",
1204             ]; # $prefix
1205 9         19 my $match;
1206 9         25 for (@$prefix) {
1207 495 50       1008 if (substr ($prefix, 0, length $_) eq $_) {
1208 0         0 $match = 1;
1209 0         0 last;
1210             }
1211             }
1212 9 50 33     155 if ($match or
    50 33        
    100 33        
      33        
      100        
1213             $pubid eq "-//W3O//DTD W3 HTML STRICT 3.0//EN//" or
1214             $pubid eq "-/W3C/DTD HTML 4.0 TRANSITIONAL/EN" or
1215             $pubid eq "HTML") {
1216            
1217 0         0 $self->_data($self->{document})->{'manakai_compat_mode'} = 'quirks';
1218             } elsif ($pubid =~ m[^-//W3C//DTD HTML 4.01 FRAMESET//] or
1219             $pubid =~ m[^-//W3C//DTD HTML 4.01 TRANSITIONAL//]) {
1220 0 0       0 if (defined $token->{sysid}) {
1221            
1222 0         0 $self->_data($self->{document})->{'manakai_compat_mode'} = 'quirks';
1223             } else {
1224            
1225 0         0 $self->_data($self->{document})->{'manakai_compat_mode'} = 'limited quirks';
1226             }
1227             } elsif ($pubid =~ m[^-//W3C//DTD XHTML 1.0 FRAMESET//] or
1228             $pubid =~ m[^-//W3C//DTD XHTML 1.0 TRANSITIONAL//]) {
1229            
1230 2         9 $self->_data($self->{document})->{'manakai_compat_mode'} ='limited quirks';
1231             } else {
1232            
1233             }
1234             } else {
1235            
1236             }
1237 392 100       947 if (defined $token->{sysid}) {
1238 13         26 my $sysid = $token->{sysid};
1239 13         27 $sysid =~ tr/A-Z/a-z/; ## ASCII case-insensitive.
1240 13 50       46 if ($sysid eq "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {
1241             ## NOTE: Ensure that |PUBLIC "(limited quirks)" "(quirks)"|
1242             ## is signaled as in quirks mode!
1243 0         0 $self->_data($self->{document})->{'manakai_compat_mode'} = 'quirks';
1244            
1245             } else {
1246            
1247             }
1248             } else {
1249            
1250             }
1251            
1252             ## Go to the "before html" insertion mode.
1253 392         1295 $token = $self->_get_next_token;
1254 392         849 return;
1255             } elsif ({
1256             START_TAG_TOKEN, 1,
1257             END_TAG_TOKEN, 1,
1258             END_OF_FILE_TOKEN, 1,
1259             }->{$token->{type}}) {
1260            
1261 193 50       641 unless ($self->_data($self->{'document'}, 'manakai_is_srcdoc'))
1262             {
1263 193         747 $self->{parse_error}->(level => $self->{level}->{must}, type => 'no DOCTYPE', token => $token);
1264 193         519 $self->_data($self->{document})->{'manakai_compat_mode'} = 'quirks';
1265             }
1266             ## Go to the "before html" insertion mode.
1267             ## reprocess
1268            
1269 193         444 return;
1270             } elsif ($token->{type} == CHARACTER_TOKEN) {
1271 128 100       552 if ($token->{data} =~ s/^([\x09\x0A\x0C\x20]+)//) {
1272             ## Ignore the token
1273              
1274 4 100       13 unless (length $token->{data}) {
1275            
1276             ## Stay in the insertion mode.
1277 2         7 $token = $self->_get_next_token;
1278 2         7 redo INITIAL;
1279             } else {
1280            
1281             }
1282             } else {
1283            
1284             }
1285              
1286 126         452 $self->{parse_error}->(level => $self->{level}->{must}, type => 'no DOCTYPE', token => $token);
1287 126         338 $self->_data($self->{document})->{'manakai_compat_mode'} = 'quirks';
1288             ## Go to the "before html" insertion mode.
1289             ## reprocess
1290 126         253 return;
1291             } elsif ($token->{type} == COMMENT_TOKEN) {
1292            
1293 9         116 my $comment = $self->{document}->createComment($token->{data});
1294             $self->_data($comment, manakai_source_line => $token->{line})
1295 9 50       57 if defined $token->{line};
1296             $self->_data($comment, manakai_source_column => $token->{column})
1297 9 50       48 if defined $token->{column};
1298 9         70 $self->{document}->appendChild($comment);
1299            
1300             ## Stay in the insertion mode.
1301 9         52 $token = $self->_get_next_token;
1302 9         45 redo INITIAL;
1303             } else {
1304 0         0 die "$0: $token->{type}: Unknown token type";
1305             }
1306             } # INITIAL
1307              
1308 0         0 die "$0: _tree_construction_initial: This should be never reached";
1309             } # _tree_construction_initial
1310              
1311             sub _tree_construction_root_element ($) {
1312 711     711   1175 my $self = shift;
1313              
1314             ## NOTE: The "before html" insertion mode.
1315            
1316             B: {
1317 711 50       1150 if ($token->{type} == DOCTYPE_TOKEN) {
  735 100       2859  
    100          
    100          
    100          
    50          
1318            
1319 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in html:#DOCTYPE', token => $token);
1320             ## Ignore the token
1321 0         0 $token = $self->_get_next_token;
1322 0         0 redo B;
1323             } elsif ($token->{type} == COMMENT_TOKEN) {
1324            
1325 5         58 my $comment = $self->{document}->createComment($token->{data});
1326             $self->_data($comment, manakai_source_line => $token->{line})
1327 5 50       33 if defined $token->{line};
1328             $self->_data($comment, manakai_source_column => $token->{column})
1329 5 50       40 if defined $token->{column};
1330 5         32 $self->{document}->appendChild($comment);
1331             ## Stay in the insertion mode.
1332 5         29 $token = $self->_get_next_token;
1333 5         22 redo B;
1334             } elsif ($token->{type} == CHARACTER_TOKEN) {
1335 191 100       789 if ($token->{data} =~ s/^([\x09\x0A\x0C\x20]+)//) {
1336             ## Ignore the token.
1337              
1338 19 100       74 unless (length $token->{data}) {
1339            
1340             ## Stay in the insertion mode.
1341 18         61 $token = $self->_get_next_token;
1342 18         48 redo B;
1343             } else {
1344            
1345             }
1346             } else {
1347            
1348             }
1349              
1350 173         451 $self->{application_cache_selection}->(undef);
1351              
1352             #
1353             } elsif ($token->{type} == START_TAG_TOKEN) {
1354 512 100       1324 if ($token->{tag_name} eq 'html') {
1355 56         110 my $root_element;
1356            
1357 56         750 $root_element = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
1358            
1359 56         147 for my $attr_name (keys %{ $token->{attributes}}) {
  56         264  
1360 5         13 my $attr_t = $token->{attributes}->{$attr_name};
1361 5         47 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
1362 5 50       24 next unless $attr;
1363 5         53 $attr->setValue ($attr_t->{value});
1364 5         22 $self->_data($attr, manakai_source_line => $attr_t->{line});
1365 5         16 $self->_data($attr, manakai_source_column => $attr_t->{column});
1366 5         38 $root_element->setAttributeNodeNS($attr);
1367             }
1368            
1369             $self->_data($root_element, manakai_source_line => $token->{line})
1370 56 50       290 if defined $token->{line};
1371             $self->_data($root_element, manakai_source_column => $token->{column})
1372 56 50       254 if defined $token->{column};
1373            
1374 56         262 $self->{document}->setDocumentElement($root_element);
1375 56         209 push @{$self->{open_elements}},
1376 56         706 [$root_element, $el_category->{html}];
1377              
1378 56 50       164 if ($token->{attributes}->{manifest}) {
1379            
1380             ## XXX resolve URL and drop fragment
1381             ##
1382             ##
1383             $self->{application_cache_selection}
1384 0         0 ->($token->{attributes}->{manifest}->{value});
1385             } else {
1386            
1387 56         181 $self->{application_cache_selection}->(undef);
1388             }
1389              
1390            
1391              
1392 56         175 $token = $self->_get_next_token;
1393 56         139 return; ## Go to the "before head" insertion mode.
1394             } else {
1395            
1396             #
1397             }
1398             } elsif ($token->{type} == END_TAG_TOKEN) {
1399 5 100       36 if ({
1400             head => 1, body => 1, html => 1, br => 1,
1401             }->{$token->{tag_name}}) {
1402            
1403             #
1404             } else {
1405            
1406             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
1407             text => $token->{tag_name},
1408 1         7 token => $token);
1409             ## Ignore the token.
1410 1         5 $token = $self->_get_next_token;
1411 1         4 redo B;
1412             }
1413             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
1414            
1415             #
1416             } else {
1417 0         0 die "$0: $token->{type}: Unknown token type";
1418             }
1419              
1420 655         1048 my $root_element;
1421            
1422 655         7500 $root_element = $self->{document}->createElementNS((HTML_NS), 'html');
1423            
1424             $self->_data($root_element, manakai_source_line => $token->{line})
1425 655 50       3132 if defined $token->{line};
1426             $self->_data($root_element, manakai_source_column => $token->{column})
1427 655 50       2937 if defined $token->{column};
1428 655         1732 $self->_data($root_element, implied => __LINE__);
1429            
1430 655         2741 $self->{document}->setDocumentElement($root_element);
1431 655         8059 push @{$self->{open_elements}}, [$root_element, $el_category->{html}];
  655         2711  
1432              
1433 655         2194 $self->{application_cache_selection}->(undef);
1434              
1435             ## NOTE: Reprocess the token.
1436            
1437 655         1375 return; ## Go to the "before head" insertion mode.
1438             } # B
1439              
1440 0         0 die "$0: _tree_construction_root_element: This should never be reached";
1441             } # _tree_construction_root_element
1442              
1443             sub _reset_insertion_mode ($) {
1444 86     86   1370 my $self = shift;
1445              
1446             ## Step 1
1447 86         178 my $last;
1448            
1449             ## Step 2
1450 86         137 my $i = -1;
1451 86         217 my $node = $self->{open_elements}->[$i];
1452            
1453             ## LOOP: Step 3
1454             LOOP: {
1455 86 50       152 if ($self->{open_elements}->[0]->[0] eq $node->[0]) {
  103         341  
1456 0         0 $last = 1;
1457 0 0       0 if (defined $self->{inner_html_node}) {
1458            
1459 0         0 $node = $self->{inner_html_node};
1460             } else {
1461 0         0 die "_reset_insertion_mode: t27";
1462             }
1463             }
1464            
1465             ## Step 4..13
1466 103         1453 my $new_mode;
1467 103 100       352 if ($node->[1] == TABLE_CELL_EL) {
    100          
1468 4 50       14 if ($last) {
1469            
1470             #
1471             } else {
1472            
1473 4         12 $new_mode = IN_CELL_IM;
1474             }
1475             } elsif ($node->[1] & FOREIGN_EL) {
1476             #
1477             } else {
1478            
1479             $new_mode = {
1480             select => IN_SELECT_IM,
1481             ## NOTE: |option| and |optgroup| do not set
1482             ## insertion mode to "in select" by themselves.
1483             tr => IN_ROW_IM,
1484             tbody => IN_TABLE_BODY_IM,
1485             thead => IN_TABLE_BODY_IM,
1486             tfoot => IN_TABLE_BODY_IM,
1487             caption => IN_CAPTION_IM,
1488             colgroup => IN_COLUMN_GROUP_IM,
1489             table => IN_TABLE_IM,
1490             head => IN_BODY_IM, # not in head!
1491             body => IN_BODY_IM,
1492             frameset => IN_FRAMESET_IM,
1493 89         1155 }->{$node->[0]->tagName};
1494             }
1495 103 100 50     632 $self->{insertion_mode} = $new_mode and last LOOP if defined $new_mode;
1496            
1497             ## Step 14
1498 17 50       68 if ($node->[1] == HTML_EL) {
1499             ## NOTE: Commented out in the spec (HTML5 revision 3894).
1500             #unless (defined $self->{head_element}) {
1501            
1502 0         0 $self->{insertion_mode} = BEFORE_HEAD_IM;
1503             #} else {
1504             ## ISSUE: Can this state be reached?
1505            
1506             # $self->{insertion_mode} = AFTER_HEAD_IM;
1507             #}
1508 0         0 last LOOP;
1509             } else {
1510            
1511             }
1512            
1513             ## Step 15
1514 17 50       58 if ($last)
1515             {
1516 0         0 $self->{insertion_mode} = IN_BODY_IM;
1517 0         0 last LOOP;
1518             }
1519            
1520             ## Step 16
1521 17         36 $i--;
1522 17         44 $node = $self->{open_elements}->[$i];
1523            
1524             ## Step 17
1525 17         41 redo LOOP;
1526             } # LOOP
1527              
1528             ## END
1529             } # _reset_insertion_mode
1530              
1531             my $parse_rcdata = sub ($$$$) {
1532             my ($self, $insert, $open_tables, $parse_refs) = @_;
1533              
1534             ## Step 1
1535             my $start_tag_name = $token->{tag_name};
1536            
1537             {
1538             my $el;
1539            
1540             $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
1541            
1542             for my $attr_name (keys %{ $token->{attributes}}) {
1543             my $attr_t = $token->{attributes}->{$attr_name};
1544             my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
1545             $attr->setValue ($attr_t->{value});
1546             $self->_data($attr, manakai_source_line => $attr_t->{line});
1547             $self->_data($attr, manakai_source_column => $attr_t->{column});
1548             $el->setAttributeNodeNS ($attr);
1549             }
1550            
1551             $self->_data($el, manakai_source_line => $token->{line})
1552             if defined $token->{line};
1553             $self->_data($el, manakai_source_column => $token->{column})
1554             if defined $token->{column};
1555            
1556             $insert->($self, $el, $open_tables);
1557             push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
1558             }
1559            
1560              
1561             ## Step 2
1562             if ($parse_refs) {
1563             $self->{state} = RCDATA_STATE;
1564             } else {
1565             $self->{state} = RAWTEXT_STATE;
1566             }
1567             delete $self->{escape}; # MUST
1568              
1569             ## Step 3, 4
1570             $self->{insertion_mode} |= IN_CDATA_RCDATA_IM;
1571              
1572            
1573             $token = $self->_get_next_token;
1574             }; # $parse_rcdata
1575              
1576             my $script_start_tag = sub ($$$) {
1577             my ($self, $insert, $open_tables) = @_;
1578            
1579             ## Step 1
1580             my $script_el;
1581            
1582             $script_el = $self->{document}->createElementNS((HTML_NS), 'script');
1583            
1584             for my $attr_name (keys %{ $token->{attributes}}) {
1585             my $attr_t = $token->{attributes}->{$attr_name};
1586             my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
1587             $attr->setValue($attr_t->{value});
1588             $self->_data($attr, manakai_source_line => $attr_t->{line});
1589             $self->_data($attr, manakai_source_column => $attr_t->{column});
1590             $script_el->setAttributeNodeNS($attr);
1591             }
1592            
1593             $self->_data($script_el, manakai_source_line => $token->{line})
1594             if defined $token->{line};
1595             $self->_data($script_el, manakai_source_column => $token->{column})
1596             if defined $token->{column};
1597            
1598              
1599             ## Step 2
1600             ## TODO: mark as "parser-inserted"
1601              
1602             ## Step 3
1603             ## TODO: Mark as "already executed", if ...
1604              
1605             ## Step 4 (HTML5 revision 2702)
1606             $insert->($self, $script_el, $open_tables);
1607             push @{$self->{open_elements}}, [$script_el, $el_category->{script}];
1608              
1609             ## Step 5
1610             $self->{state} = SCRIPT_DATA_STATE;
1611             delete $self->{escape}; # MUST
1612              
1613             ## Step 6-7
1614             $self->{insertion_mode} |= IN_CDATA_RCDATA_IM;
1615              
1616            
1617             $token = $self->_get_next_token;
1618             }; # $script_start_tag
1619              
1620             sub push_afe ($$)
1621             {
1622 0     0 0 0 my ($item => $afes) = @_;
1623 0         0 my $item_token = $item->[2];
1624              
1625 0         0 my $depth = 0;
1626 0         0 OUTER: for my $i (reverse 0..$#$afes)
1627             {
1628 0         0 my $afe = $afes->[$i];
1629 0 0       0 if ($afe->[0] eq '#marker')
1630             {
1631 0         0 last OUTER;
1632             }
1633             else
1634             {
1635 0         0 my $token = $afe->[2];
1636             ## Both |$token| and |$item_token| should be start tag tokens.
1637 0 0       0 if ($token->{tag_name} eq $item_token->{tag_name})
1638             {
1639 0 0       0 if ((keys %{$token->{attributes}}) !=
  0         0  
1640 0         0 (keys %{$item_token->{attributes}}))
1641             {
1642 0         0 next OUTER;
1643             }
1644 0         0 for my $attr_name (keys %{$item_token->{attributes}})
  0         0  
1645             {
1646 0 0       0 next OUTER unless $token->{attributes}->{$attr_name};
1647             next OUTER unless
1648             $token->{attributes}->{$attr_name}->{value} eq
1649 0 0       0 $item_token->{attributes}->{$attr_name}->{value};
1650             }
1651 0         0 $depth++;
1652 0 0       0 if ($depth == 3)
1653             {
1654 0         0 splice @$afes, $i, 1 => ();
1655 0         0 last OUTER;
1656             }
1657             }
1658              
1659             ## We don't have to check namespaces of elements and attributes,
1660             ## nevertheless the spec requires it, because |$afes| could
1661             ## never contain a non-HTML element at the time of writing. In
1662             ## addition, scripted changes would never change the original
1663             ## start tag token.
1664             }
1665             } # OUTER
1666              
1667 0         0 push @$afes, $item;
1668             } # push_afe
1669              
1670              
1671             my $formatting_end_tag = sub {
1672             my ($self, $active_formatting_elements, $open_tables, $end_tag_token) = @_;
1673             my $tag_name = $end_tag_token->{tag_name};
1674              
1675             ## NOTE: The adoption agency algorithm (AAA).
1676              
1677             ## Step 1
1678             my $outer_loop_counter = 0;
1679            
1680             OUTER: {
1681             if ($outer_loop_counter >= 8)
1682             {
1683             $token = $self->_get_next_token;
1684             last OUTER;
1685             }
1686              
1687             ## Step 3
1688             $outer_loop_counter++;
1689            
1690             ## Step 4
1691             my $formatting_element;
1692             my $formatting_element_i_in_active;
1693             AFE: for (reverse 0..$#$active_formatting_elements) {
1694             if ($active_formatting_elements->[$_]->[0] eq '#marker') {
1695            
1696             last AFE;
1697             } elsif ($active_formatting_elements->[$_]->[0]->tagName
1698             eq $tag_name) {
1699            
1700             $formatting_element = $active_formatting_elements->[$_];
1701             $formatting_element_i_in_active = $_;
1702             last AFE;
1703             }
1704             } # AFE
1705             unless (defined $formatting_element) {
1706            
1707             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', text => $tag_name, token => $end_tag_token);
1708             ## Ignore the token
1709             $token = $self->_get_next_token;
1710             return;
1711             }
1712             ## has an element in scope
1713             my $in_scope = 1;
1714             my $formatting_element_i_in_open;
1715             INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
1716             my $node = $self->{open_elements}->[$_];
1717             if ($node->[0] eq $formatting_element->[0]) {
1718             if ($in_scope) {
1719            
1720             $formatting_element_i_in_open = $_;
1721             last INSCOPE;
1722             } else { # in open elements but not in scope
1723            
1724             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
1725             text => $token->{tag_name},
1726             token => $end_tag_token);
1727             ## Ignore the token
1728             $token = $self->_get_next_token;
1729             return;
1730             }
1731             } elsif ($node->[1] & SCOPING_EL) {
1732            
1733             $in_scope = 0;
1734             }
1735             } # INSCOPE
1736             unless (defined $formatting_element_i_in_open) {
1737            
1738             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
1739             text => $token->{tag_name},
1740             token => $end_tag_token);
1741             pop @$active_formatting_elements; # $formatting_element
1742             $token = $self->_get_next_token; ## TODO: ok?
1743             return;
1744             }
1745             if (not $self->{open_elements}->[-1]->[0] eq $formatting_element->[0]) {
1746            
1747             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
1748             text => $self->{open_elements}->[-1]->[0]
1749             ->tagName,
1750             token => $end_tag_token);
1751             }
1752            
1753             ## Step 5
1754             my $furthest_block;
1755             my $furthest_block_i_in_open;
1756             OE: for (reverse 0..$#{$self->{open_elements}}) {
1757             my $node = $self->{open_elements}->[$_];
1758             if ($node->[1] & SPECIAL_EL or $node->[1] & SCOPING_EL) { ## "Special"
1759             $furthest_block = $node;
1760             $furthest_block_i_in_open = $_;
1761             ## NOTE: The topmost (eldest) node.
1762             } elsif ($node->[0] eq $formatting_element->[0]) {
1763            
1764             last OE;
1765             }
1766             } # OE
1767            
1768             ## Step 6
1769             unless (defined $furthest_block) { # MUST
1770            
1771             splice @{$self->{open_elements}}, $formatting_element_i_in_open;
1772             splice @$active_formatting_elements, $formatting_element_i_in_active, 1;
1773             $token = $self->_get_next_token;
1774             return;
1775             }
1776            
1777             ## Step 7
1778             my $common_ancestor_node = $self->{open_elements}->[$formatting_element_i_in_open - 1];
1779            
1780             ## Step 8
1781             my $bookmark_prev_el
1782             = $active_formatting_elements->[$formatting_element_i_in_active - 1]
1783             ->[0];
1784            
1785             ## Step 9
1786             my $node = $furthest_block;
1787             my $node_i_in_open = $furthest_block_i_in_open;
1788             my $last_node = $furthest_block;
1789            
1790             ## Step 9.1
1791             my $inner_loop_counter = 0;
1792            
1793             INNER: {
1794             ## Step 9.2
1795             if ($inner_loop_counter >= 3) {
1796             $token = $self->_get_next_token;
1797             last OUTER;
1798             }
1799              
1800             ## Step 9.3
1801             $inner_loop_counter++;
1802            
1803             ## Step 9.4
1804             $node_i_in_open--;
1805             $node = $self->{open_elements}->[$node_i_in_open];
1806            
1807             ## Step 9.5
1808             my $node_i_in_active;
1809             my $node_token;
1810             S7S2: {
1811             for (reverse 0..$#$active_formatting_elements) {
1812             if ($active_formatting_elements->[$_]->[0] eq $node->[0]) {
1813            
1814             $node_i_in_active = $_;
1815             $node_token = $active_formatting_elements->[$_]->[2];
1816             last S7S2;
1817             }
1818             }
1819             splice @{$self->{open_elements}}, $node_i_in_open, 1;
1820             redo INNER;
1821             } # S7S2
1822            
1823             ## Step 9.6
1824             last INNER if $node->[0] eq $formatting_element->[0];
1825            
1826             ## Step 9.7
1827             if ($node->[0]->hasChildNodes ()) {
1828            
1829             my $new_element = [];
1830            
1831             $new_element->[0] = $self->{document}->createElementNS((HTML_NS), $node_token->{tag_name});
1832            
1833             for my $attr_name (keys %{ $node_token->{attributes}}) {
1834             my $attr_t = $node_token->{attributes}->{$attr_name};
1835             my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
1836             $attr->setValue ($attr_t->{value});
1837             $self->_data($attr, manakai_source_line => $attr_t->{line});
1838             $self->_data($attr, manakai_source_column => $attr_t->{column});
1839             $new_element->[0]->setAttributeNodeNS($attr);
1840             }
1841            
1842             $self->_data($new_element->[0], manakai_source_line => $node_token->{line})
1843             if defined $node_token->{line};
1844             $self->_data($new_element->[0], manakai_source_column => $node_token->{column})
1845             if defined $node_token->{column};
1846            
1847             $new_element->[1] = $node->[1];
1848             $new_element->[2] = $node_token;
1849             $active_formatting_elements->[$node_i_in_active] = $new_element;
1850             $self->{open_elements}->[$node_i_in_open] = $new_element;
1851             $node = $new_element;
1852             }
1853              
1854             ## Step 9.8
1855             if ($last_node->[0] eq $furthest_block->[0]) {
1856            
1857             $bookmark_prev_el = $node->[0];
1858             }
1859            
1860             ## Step 9.9
1861             $node->[0]->appendChild ($last_node->[0]);
1862            
1863             ## Step 9.10
1864             $last_node = $node;
1865            
1866             ## Step 9.11
1867             redo INNER;
1868             } # INNER
1869            
1870             ## Step 10
1871             if ($common_ancestor_node->[1] & TABLE_ROWS_EL) {
1872             ## Foster parenting.
1873             my $foster_parent_element;
1874             my $next_sibling;
1875             OE: for (reverse 0..$#{$self->{open_elements}}) {
1876             if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {
1877            
1878             $foster_parent_element = $self->{open_elements}->[$_ - 1]->[0];
1879             $next_sibling = $self->{open_elements}->[$_]->[0];
1880             undef $next_sibling
1881             unless $next_sibling->parentNode eq $foster_parent_element;
1882             last OE;
1883             }
1884             } # OE
1885             $foster_parent_element ||= $self->{open_elements}->[0]->[0];
1886              
1887             $foster_parent_element->insertBefore ($last_node->[0], $next_sibling);
1888             $open_tables->[-1]->[1] = 1; # tainted
1889             } else {
1890            
1891             $common_ancestor_node->[0]->appendChild ($last_node->[0]);
1892             }
1893            
1894             ## Step 11
1895             my $new_element = [];
1896            
1897             $new_element->[0] = $self->{document}->createElementNS((HTML_NS), $formatting_element->[2]->{tag_name});
1898            
1899             for my $attr_name (keys %{ $formatting_element->[2]->{attributes}}) {
1900             my $attr_t = $formatting_element->[2]->{attributes}->{$attr_name};
1901             my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
1902             $attr->setValue ($attr_t->{value});
1903             $self->_data($attr, manakai_source_line => $attr_t->{line});
1904             $self->_data($attr, manakai_source_column => $attr_t->{column});
1905             $new_element->[0]->setAttributeNodeNS($attr);
1906             }
1907            
1908             $self->_data($new_element->[0], manakai_source_line => $formatting_element->[2]->{line})
1909             if defined $formatting_element->[2]->{line};
1910             $self->_data($new_element->[0], manakai_source_column => $formatting_element->[2]->{column})
1911             if defined $formatting_element->[2]->{column};
1912            
1913             $new_element->[1] = $formatting_element->[1];
1914             $new_element->[2] = $formatting_element->[2];
1915            
1916             ## Step 12
1917             my @cn = $furthest_block->[0]->childNodes;
1918             $new_element->[0]->appendChild($_) for @cn;
1919            
1920             ## Step 13
1921             $furthest_block->[0]->appendChild ($new_element->[0]);
1922            
1923             ## Step 14
1924             my $i;
1925             AFE: for (reverse 0..$#$active_formatting_elements) {
1926             if ($active_formatting_elements->[$_]->[0] eq $formatting_element->[0]) {
1927            
1928             splice @$active_formatting_elements, $_, 1;
1929             $i-- and last AFE if defined $i;
1930             } elsif ($active_formatting_elements->[$_]->[0] eq $bookmark_prev_el) {
1931            
1932             $i = $_;
1933             }
1934             } # AFE
1935             splice @$active_formatting_elements, (defined $i ? $i : 0) + 1, 0, $new_element;
1936            
1937             ## Step 15
1938             undef $i;
1939             OE: for (reverse 0..$#{$self->{open_elements}}) {
1940             if ($self->{open_elements}->[$_]->[0] eq $formatting_element->[0]) {
1941            
1942             splice @{$self->{open_elements}}, $_, 1;
1943             $i-- and last OE if defined $i;
1944             } elsif ($self->{open_elements}->[$_]->[0] eq $furthest_block->[0]) {
1945            
1946             $i = $_;
1947             }
1948             } # OE
1949             splice @{$self->{open_elements}}, $i + 1, 0, $new_element;
1950            
1951             ## Step 16
1952             redo OUTER;
1953             } # OUTER
1954             }; # $formatting_end_tag
1955              
1956             my $reconstruct_active_formatting_elements = sub ($$$$) { # MUST
1957             my ($self, $insert, $active_formatting_elements, $open_tables) = @_;
1958              
1959             ## Step 1
1960             return unless @$active_formatting_elements;
1961              
1962             ## Step 3
1963             my $i = -1;
1964             my $entry = $active_formatting_elements->[$i];
1965              
1966             ## Step 2
1967             return if $entry->[0] eq '#marker';
1968             for (@{$self->{open_elements}}) {
1969             if ($entry->[0] eq $_->[0]) {
1970            
1971             return;
1972             }
1973             }
1974            
1975             S4: {
1976             ## Step 4
1977             last S4 if $active_formatting_elements->[0]->[0] eq $entry->[0];
1978              
1979             ## Step 5
1980             $i--;
1981             $entry = $active_formatting_elements->[$i];
1982              
1983             ## Step 6
1984             if ($entry->[0] eq '#marker') {
1985            
1986             #
1987             } else {
1988             my $in_open_elements;
1989             OE: for (@{$self->{open_elements}}) {
1990             if ($entry->[0] eq $_->[0]) {
1991            
1992             $in_open_elements = 1;
1993             last OE;
1994             }
1995             }
1996             if ($in_open_elements) {
1997            
1998             #
1999             } else {
2000             ## NOTE:

X

2001            
2002             redo S4;
2003             }
2004             }
2005              
2006             ## Step 7
2007             $i++;
2008             $entry = $active_formatting_elements->[$i];
2009             } # S4
2010              
2011             S7: {
2012             ## Step 8
2013             my $clone = [$entry->[0]->cloneNode(0), $entry->[1], $entry->[2]];
2014            
2015             ## Step 9
2016             $insert->($self, $clone->[0], $open_tables);
2017             push @{$self->{open_elements}}, $clone;
2018            
2019             ## Step 10
2020             $active_formatting_elements->[$i] = $self->{open_elements}->[-1];
2021              
2022             ## Step 11
2023             unless ($clone->[0] eq $active_formatting_elements->[-1]->[0]) {
2024            
2025             ## Step 7'
2026             $i++;
2027             $entry = $active_formatting_elements->[$i];
2028            
2029             redo S7;
2030             }
2031              
2032            
2033             } # S7
2034             }; # $reconstruct_active_formatting_elements
2035              
2036             my $clear_up_to_marker = sub ($) {
2037             my $active_formatting_elements = $_[0];
2038             for (reverse 0..$#$active_formatting_elements) {
2039             if ($active_formatting_elements->[$_]->[0] eq '#marker') {
2040            
2041             splice @$active_formatting_elements, $_;
2042             return;
2043             }
2044             }
2045              
2046            
2047             }; # $clear_up_to_marker
2048              
2049             my $insert_to_current = sub {
2050             #my ($self, $child, $open_tables) = @_;
2051             $_[0]->{open_elements}->[-1]->[0]->appendChild ($_[1]);
2052             }; # insert_to_current
2053              
2054             ## Foster parenting. Note that there are three "foster parenting"
2055             ## code in the parser: for elements (this one), for texts, and for
2056             ## elements in the AAA code.
2057             my $insert_to_foster = sub {
2058             my ($self, $child, $open_tables) = @_;
2059             if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) {
2060             # MUST
2061             my $foster_parent_element;
2062             my $next_sibling;
2063             OE: for (reverse 0..$#{$self->{open_elements}}) {
2064             if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {
2065            
2066             $foster_parent_element = $self->{open_elements}->[$_ - 1]->[0];
2067             $next_sibling = $self->{open_elements}->[$_]->[0];
2068             undef $next_sibling
2069             unless $next_sibling->parentNode eq $foster_parent_element;
2070             last OE;
2071             }
2072             } # OE
2073             $foster_parent_element ||= $self->{open_elements}->[0]->[0];
2074              
2075             # This conditional bit is by TOBY
2076             if ($next_sibling)
2077             {
2078             $foster_parent_element->insertBefore ($child, $next_sibling);
2079             }
2080             else
2081             {
2082             $foster_parent_element->appendChild($child);
2083             }
2084             $open_tables->[-1]->[1] = 1; # tainted
2085             } else {
2086            
2087             $self->{open_elements}->[-1]->[0]->appendChild ($child);
2088             }
2089             }; # $insert_to_foster
2090              
2091             sub _tree_construction_main ($) {
2092 711     711   1269 my $self = shift;
2093              
2094             ## "List of active formatting elements". Each item in this array is
2095             ## an array reference, which contains: [0] - the element node; [1] -
2096             ## the local name of the element; [2] - the token that is used to
2097             ## create [0].
2098 711         1321 my $active_formatting_elements = [];
2099              
2100 711         1104 my $insert;
2101              
2102             ## NOTE: $open_tables->[-1]->[0] is the "current table" element node.
2103             ## NOTE: $open_tables->[-1]->[1] is the "tainted" flag (OBSOLETE; unused).
2104             ## NOTE: $open_tables->[-1]->[2] is set false when non-Text node inserted.
2105 711         2267 my $open_tables = [[$self->{open_elements}->[0]->[0]]];
2106              
2107 711         1302 $insert = $insert_to_current;
2108              
2109             ## NOTE: Insert a character (MUST): When a character is inserted, if
2110             ## the last node that was inserted by the parser is a Text node and
2111             ## the character has to be inserted after that node, then the
2112             ## character is appended to the Text node. However, if any other
2113             ## node is inserted by the parser, then a new Text node is created
2114             ## and the character is appended as that Text node. If I'm not
2115             ## wrong, for a parser with scripting disabled, there are only two
2116             ## cases where this occurs. It is the case where an element or
2117             ## comment is inserted into the |table| subtree while foster
2118             ## parenting happens. This is covered by using the [2] flag of the
2119             ## |$open_tables| structure. All other cases are handled simply by
2120             ## calling |manakai_append_text| method.
2121            
2122 711         1128 B: while (1) {
2123 5216 50       19085 if ($token->{n}++ == 100) {
2124 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'parser impl error', # XXXtest
2125             token => $token);
2126 0         0 require Data::Dumper;
2127 0         0 warn "====== HTML Parser Error ======\n";
2128 0         0 warn join (' ', map { $_->[0]->tagName } @{$self->{open_elements}}) . ' #' . $self->{insertion_mode} . "\n";
  0         0  
  0         0  
2129 0         0 warn Data::Dumper::Dumper ($token);
2130 0         0 $token = $self->_get_next_token;
2131 0         0 next B;
2132             }
2133             ##
2134 5216 100 66     7781 if (
      100        
      100        
      100        
      66        
      100        
      100        
      100        
      100        
      100        
      66        
      100        
      100        
      100        
      100        
2135             (not @{$self->{open_elements}}) or
2136             (not $self->{open_elements}->[-1]->[1] & FOREIGN_EL) or ## HTML element
2137             ($self->{open_elements}->[-1]->[1] == MML_TEXT_INTEGRATION_EL and
2138             (($token->{type} == START_TAG_TOKEN and
2139             $token->{tag_name} ne 'mglyph' and
2140             $token->{tag_name} ne 'malignmark') or
2141             $token->{type} == CHARACTER_TOKEN)) or
2142             ($self->{open_elements}->[-1]->[1] & MML_AXML_EL and
2143             $token->{type} == START_TAG_TOKEN and
2144             $token->{tag_name} eq 'svg') or
2145             ( ## If the current node is an HTML integration point (other
2146             ## than |annotation-xml|).
2147             $self->{open_elements}->[-1]->[1] == SVG_INTEGRATION_EL and
2148             ($token->{type} == START_TAG_TOKEN or
2149             $token->{type} == CHARACTER_TOKEN)) or
2150             ( ## If the current node is an |annotation-xml| whose |encoding|
2151             ## is |text/html| or |application/xhtml+xml| (HTML integration
2152             ## point).
2153             $self->{open_elements}->[-1]->[1] == MML_AXML_EL and
2154             ($token->{type} == START_TAG_TOKEN or
2155             $token->{type} == CHARACTER_TOKEN) and
2156             do {
2157 7   100     26 my $encoding = $self->{open_elements}->[-1]->[0]->getAttributeNS(undef, 'encoding') || '';
2158 7         147 $encoding =~ tr/A-Z/a-z/; ## ASCII case-insensitive.
2159 7 100 100     31 if ($encoding eq 'text/html' or
2160             $encoding eq 'application/xhtml+xml') {
2161 4         18 1;
2162             } else {
2163 3         17 0;
2164             }
2165             }) or
2166             ($token->{type} == END_OF_FILE_TOKEN)) {
2167            
2168             ## Use the rules for the current insertion mode in HTML content.
2169             #
2170             } else {
2171             ## Use the rules for the foreign content.
2172 269 100       868 if ($token->{type} == CHARACTER_TOKEN) {
    100          
    50          
    0          
    0          
2173             ## "In foreign content", character tokens.
2174 31         98 my $data = $token->{data};
2175 31         186 while ($data =~ s/\x00/\x{FFFD}/) {
2176 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'NULL', token => $token);
2177             }
2178 31         158 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $data, $token);
2179 31 100       202 if ($data =~ /[^\x09\x0A\x0C\x0D\x20]/) {
2180 30         75 delete $self->{frameset_ok};
2181             }
2182            
2183 31         119 $token = $self->_get_next_token;
2184 31         91 next B;
2185             } elsif ($token->{type} == START_TAG_TOKEN) {
2186             ## "In foreign content", start tag token.
2187              
2188 135 100 0     3152 if (
      33        
      66        
2189             {
2190             b => 1, big => 1, blockquote => 1, body => 1, br => 1,
2191             center => 1, code => 1, dd => 1, div => 1, dl => 1, dt => 1,
2192             em => 1, embed => 1, h1 => 1, h2 => 1, h3 => 1, h4 => 1,
2193             h5 => 1, h6 => 1, head => 1, hr => 1, i => 1, img => 1, li => 1,
2194             listing => 1, menu => 1, meta => 1, nobr => 1, ol => 1,
2195             p => 1, pre => 1, ruby => 1, s => 1, small => 1, span => 1,
2196             strong => 1, strike => 1, sub => 1, sup => 1, table => 1,
2197             tt => 1, u => 1, ul => 1, var => 1,
2198             }->{$token->{tag_name}} or
2199             ($token->{tag_name} eq 'font' and
2200             ($token->{attributes}->{color} or
2201             $token->{attributes}->{face} or
2202             $token->{attributes}->{size}))
2203             ) {
2204            
2205             ## "In foreign content", HTML-only start tag.
2206             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
2207 11         101 text => $self->{open_elements}->[-1]->[0]
2208             ->localname,
2209             token => $token);
2210              
2211 11         25 pop @{$self->{open_elements}};
  11         32  
2212             V: {
2213 11         42 my $current_node = $self->{open_elements}->[-1];
  14         186  
2214 14 50 66     94 if (
      100        
      33        
      66        
2215             ## An HTML element.
2216             not $current_node->[1] & FOREIGN_EL or
2217              
2218             ## An MathML text integration point.
2219             $current_node->[1] == MML_TEXT_INTEGRATION_EL or
2220            
2221             ## An HTML integration point.
2222             $current_node->[1] == SVG_INTEGRATION_EL or
2223             ($current_node->[1] == MML_AXML_EL and
2224             do {
2225 0   0     0 my $encoding = $current_node->[0]->getAttributeNS(undef, 'encoding') || '';
2226 0         0 $encoding =~ tr/A-Z/a-z/; ## ASCII case-insensitive.
2227 0 0       0 ($encoding eq 'text/html' or
2228             $encoding eq 'application/xhtml+xml');
2229             })
2230             ) {
2231 11         26 last V;
2232             }
2233            
2234 3         5 pop @{$self->{open_elements}};
  3         7  
2235 3         9 redo V;
2236             }
2237            
2238             ## Reprocess the token.
2239 11         64 next B;
2240              
2241             } else {
2242             ## "In foreign content", foreign start tag.
2243 124         820 my $nsuri = $self->{open_elements}->[-1]->[0]->namespaceURI;
2244 124         315 my $tag_name = $token->{tag_name};
2245 124 100       343 if ($nsuri eq (SVG_NS)) {
2246             $tag_name = {
2247             altglyph => 'altGlyph',
2248             altglyphdef => 'altGlyphDef',
2249             altglyphitem => 'altGlyphItem',
2250             animatecolor => 'animateColor',
2251             animatemotion => 'animateMotion',
2252             animatetransform => 'animateTransform',
2253             clippath => 'clipPath',
2254             feblend => 'feBlend',
2255             fecolormatrix => 'feColorMatrix',
2256             fecomponenttransfer => 'feComponentTransfer',
2257             fecomposite => 'feComposite',
2258             feconvolvematrix => 'feConvolveMatrix',
2259             fediffuselighting => 'feDiffuseLighting',
2260             fedisplacementmap => 'feDisplacementMap',
2261             fedistantlight => 'feDistantLight',
2262             feflood => 'feFlood',
2263             fefunca => 'feFuncA',
2264             fefuncb => 'feFuncB',
2265             fefuncg => 'feFuncG',
2266             fefuncr => 'feFuncR',
2267             fegaussianblur => 'feGaussianBlur',
2268             feimage => 'feImage',
2269             femerge => 'feMerge',
2270             femergenode => 'feMergeNode',
2271             femorphology => 'feMorphology',
2272             feoffset => 'feOffset',
2273             fepointlight => 'fePointLight',
2274             fespecularlighting => 'feSpecularLighting',
2275             fespotlight => 'feSpotLight',
2276             fetile => 'feTile',
2277             feturbulence => 'feTurbulence',
2278             foreignobject => 'foreignObject',
2279             glyphref => 'glyphRef',
2280             lineargradient => 'linearGradient',
2281             radialgradient => 'radialGradient',
2282             #solidcolor => 'solidColor', ## NOTE: Commented in spec (SVG1.2)
2283             textpath => 'textPath',
2284 67   66     2340 }->{$tag_name} || $tag_name;
2285             }
2286              
2287             ## "adjust SVG attributes" (SVG only) - done in insert-element-f
2288              
2289             ## "adjust foreign attributes" - done in insert-element-f
2290              
2291            
2292             {
2293 124         549 my $el;
  124         206  
2294            
2295 124         972 $el = $self->{document}->createElementNS($nsuri, $tag_name);
2296            
2297 124         247 for my $attr_name (keys %{ $token->{attributes}}) {
  124         531  
2298 13         30 my $attr_t = $token->{attributes}->{$attr_name};
2299 13         23 my $attr;
2300 13 100 66     78 if (defined $foreign_attr_xname->{ $attr_name })
    100          
    50          
    0          
2301             {
2302 6         12 my $xmlnsuri = $foreign_attr_xname->{ $attr_name }->[0];
2303 6         11 my $qname = join ':', @{$foreign_attr_xname->{ $attr_name }->[1]};
  6         32  
2304 6         32 $qname =~ s/(^:)|(:$)//;
2305 6         40 $attr = $self->{document}->createAttributeNS($xmlnsuri, $qname);
2306             }
2307             elsif ($nsuri eq (MML_NS) && $attr_name eq 'definitionurl')
2308             {
2309 1         13 $attr = $self->{document}->createAttributeNS((MML_NS), 'math:definitionURL');
2310             }
2311             elsif ($nsuri eq (MML_NS) )
2312             {
2313 6         77 $attr = $self->{document}->createAttributeNS((MML_NS), "math:$attr_name");
2314             }
2315             elsif ($nsuri eq (SVG_NS) )
2316             {
2317             $attr = $self->{document}->createAttributeNS(
2318 0   0     0 (SVG_NS), "svg:".($svg_attr_name->{$attr_name} || $attr_name));
2319             }
2320 13 50       41 unless (defined $attr)
2321             {
2322 0         0 $attr = $self->{document}->createAttributeNS($nsuri, $attr_name);
2323             }
2324 13 50       33 unless (defined $attr)
2325             {
2326 0         0 $attr = $self->{document}->createAttribute($attr_name);
2327             }
2328 13 50       50 if ($attr)
2329             {
2330 13         110 $attr->setValue($attr_t->{value});
2331 13         43 $self->_data($attr, manakai_source_line => $attr_t->{line});
2332 13         35 $self->_data($attr, manakai_source_column => $attr_t->{column});
2333 13         93 $el->setAttributeNodeNS($attr);
2334             }
2335             }
2336            
2337             $self->_data($el, manakai_source_line => $token->{line})
2338 124 50       633 if defined $token->{line};
2339             $self->_data($el, manakai_source_column => $token->{column})
2340 124 50       573 if defined $token->{column};
2341            
2342 124         469 $insert->($self, $el, $open_tables);
2343 124 50 100     512 push @{$self->{open_elements}}, [$el, ($el_category_f->{$nsuri}->{ $tag_name} || 0) | FOREIGN_EL | (($nsuri) eq SVG_NS ? SVG_EL : ($nsuri) eq MML_NS ? MML_EL : 0)];
  124 100       2497  
2344            
2345 124 50 33     487 if ( $token->{attributes}->{xmlns} and $token->{attributes}->{xmlns}->{value} ne ($nsuri)) {
2346 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'bad namespace', token => $token);
2347             ## TODO: Error type documentation
2348             }
2349 124 50 33     440 if ( $token->{attributes}->{'xmlns:xlink'} and
2350             $token->{attributes}->{'xmlns:xlink'}->{value} ne q) {
2351 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'bad namespace', token => $token);
2352             }
2353             }
2354            
2355              
2356 124 100       292 if ($self->{self_closing}) {
2357 2         4 pop @{$self->{open_elements}};
  2         5  
2358 2         6 delete $self->{self_closing};
2359             } else {
2360            
2361             }
2362              
2363 124         424 $token = $self->_get_next_token;
2364 124         756 next B;
2365             }
2366            
2367             } elsif ($token->{type} == END_TAG_TOKEN) {
2368             ## "In foreign content", end tag.
2369            
2370 103 100 66     398 if ($token->{tag_name} eq 'script' and
2371             $self->{open_elements}->[-1]->[1] == SVG_SCRIPT_EL) {
2372             ## "In foreign content", "script" end tag, if the current
2373             ## node is an SVG |script| element.
2374            
2375 1         3 pop @{$self->{open_elements}};
  1         4  
2376            
2377             ## XXXscript: Execute script here.
2378 1         5 $token = $self->_get_next_token;
2379 1         3 next B;
2380            
2381             } else {
2382             ## "In foreign content", end tag.
2383            
2384             ## 1.
2385 102         200 my $i = -1;
2386 102         192 my $node = $self->{open_elements}->[$i];
2387            
2388             ## 2.
2389 102         467 my $tag_name = $node->[0]->localname;
2390 102         352 $tag_name =~ tr/A-Z/a-z/; ## ASCII case-insensitive.
2391 102 100       305 if ($tag_name ne $token->{tag_name}) {
2392             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
2393             text => $token->{tag_name},
2394 14         66 level => $self->{level}->{must});
2395             }
2396              
2397             ## 3.
2398             LOOP: {
2399 102         169 my $tag_name = $node->[0]->localname;
  112         341  
2400 112         235 $tag_name =~ tr/A-Z/a-z/; ## ASCII case-insensitive.
2401 112 100       316 if ($tag_name eq $token->{tag_name}) {
2402 89         186 splice @{$self->{open_elements}}, $i, -$i, ();
  89         247  
2403 89         282 $token = $self->_get_next_token;
2404 89         387 next B;
2405             }
2406            
2407             ## 4.
2408 23         33 $i--;
2409 23         49 $node = $self->{open_elements}->[$i];
2410              
2411             ## 5.
2412 23 100       59 if ($node->[1] & FOREIGN_EL) {
2413 10         21 redo LOOP;
2414             }
2415             } # LOOP
2416              
2417             ## Step 6 (Use the current insertion mode in HTML content)
2418             #
2419             }
2420              
2421             } elsif ($token->{type} == COMMENT_TOKEN) {
2422             ## "In foreign content", comment token.
2423 0         0 my $comment = $self->{document}->createComment($token->{data});
2424             $self->_data($comment, manakai_source_line => $token->{line})
2425 0 0       0 if defined $token->{line};
2426             $self->_data($comment, manakai_source_column => $token->{column})
2427 0 0       0 if defined $token->{column};
2428 0         0 $self->{open_elements}->[-1]->[0]->appendChild ($comment);
2429 0         0 $token = $self->_get_next_token;
2430 0         0 next B;
2431             } elsif ($token->{type} == DOCTYPE_TOKEN) {
2432            
2433             ## "In foreign content", DOCTYPE token.
2434 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in html:#DOCTYPE', token => $token);
2435             ## Ignore the token.
2436 0         0 $token = $self->_get_next_token;
2437 0         0 next B;
2438             } else {
2439 0         0 die "$0: $token->{type}: Unknown token type";
2440             }
2441             } # foreign
2442              
2443             ## The "in table text" insertion mode.
2444 4960 100 100     15133 if ($self->{insertion_mode} & TABLE_IMS and
2445             not $self->{insertion_mode} & IN_CDATA_RCDATA_IM) {
2446             C: {
2447 504         844 my $s;
  504         742  
2448 504 100       1098 if ($token->{type} == CHARACTER_TOKEN) {
2449            
2450 104   100     539 $self->{pending_chars} ||= [];
2451 104         172 push @{$self->{pending_chars}}, $token;
  104         297  
2452 104         310 $token = $self->_get_next_token;
2453 104         223 next B;
2454             } else {
2455             ## There is an "insert pending chars" code clone.
2456 400 100       788 if ($self->{pending_chars}) {
2457 100         173 $s = join '', map { $_->{data} } @{$self->{pending_chars}};
  104         442  
  100         279  
2458 100         354 delete $self->{pending_chars};
2459 100         378 while ($s =~ s/\x00//) {
2460 3         11 $self->{parse_error}->(level => $self->{level}->{must}, type => 'NULL', token => $token);
2461             }
2462 100 50       524 if ($s eq '') {
    100          
2463 0         0 last C;
2464             } elsif ($s =~ /[^\x09\x0A\x0C\x0D\x20]/) {
2465             #
2466             } else {
2467            
2468 25         117 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $s, $token);
2469 25         85 last C;
2470             }
2471             } else {
2472            
2473 300         594 last C;
2474             }
2475             }
2476              
2477             ## "in table" insertion mode, "Anything else".
2478              
2479             ## Foster parenting.
2480 75         309 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in table:#text', token => $token);
2481              
2482             ## NOTE: As if in body, but insert into the foster parent element.
2483 75         274 $reconstruct_active_formatting_elements
2484             ->($self, $insert_to_foster, $active_formatting_elements,
2485             $open_tables);
2486            
2487 75 100       408 if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) {
2488             # MUST
2489 25         55 my $foster_parent_element;
2490             my $next_sibling;
2491 25         58 OE: for (reverse 0..$#{$self->{open_elements}}) {
  25         91  
2492 41 100       118 if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {
2493            
2494 25         69 $foster_parent_element = $self->{open_elements}->[$_ - 1]->[0];
2495 25         49 $next_sibling = $self->{open_elements}->[$_]->[0];
2496 25 50       181 undef $next_sibling
2497             unless $next_sibling->parentNode eq $foster_parent_element;
2498 25         442 last OE;
2499             }
2500             } # OE
2501 25   33     360 $foster_parent_element ||= $self->{open_elements}->[0]->[0];
2502            
2503             $foster_parent_element->insertBefore
2504 25         403 ($self->{document}->createTextNode($s), $next_sibling);
2505              
2506 25         92 $open_tables->[-1]->[1] = 1; # tainted
2507 25         58 $open_tables->[-1]->[2] = 1; # ~node inserted
2508             } else {
2509             ## NOTE: Fragment case or in a foster parent'ed element
2510             ## (e.g. |a|). In fragment case, whether the
2511             ## character is appended to existing node or a new node is
2512             ## created is irrelevant, since the foster parent'ed nodes
2513             ## are discarded and fragment parsing does not invoke any
2514             ## script.
2515            
2516 50         165 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $s);
2517             }
2518             } # C
2519             } # TABLE_IMS
2520              
2521 4856 100 100     23059 if ($token->{type} == DOCTYPE_TOKEN) {
    100          
    100          
    100          
2522            
2523 2         12 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in html:#DOCTYPE', token => $token);
2524             ## Ignore the token
2525             ## Stay in the phase
2526 2         9 $token = $self->_get_next_token;
2527 2         5 next B;
2528             } elsif ($token->{type} == START_TAG_TOKEN and
2529             $token->{tag_name} eq 'html') {
2530 9 100       52 if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) {
    100          
2531            
2532 1         6 $self->{parse_error}->(level => $self->{level}->{must}, type => 'after html', text => 'html', token => $token);
2533 1         2 $self->{insertion_mode} = AFTER_BODY_IM;
2534             } elsif ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) {
2535            
2536 1         6 $self->{parse_error}->(level => $self->{level}->{must}, type => 'after html', text => 'html', token => $token);
2537 1         2 $self->{insertion_mode} = AFTER_FRAMESET_IM;
2538             } else {
2539            
2540             }
2541              
2542            
2543 9         39 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not first start tag', token => $token);
2544 9         23 my $top_el = $self->{open_elements}->[0]->[0];
2545 9         15 for my $attr_name (keys %{$token->{attributes}}) {
  9         50  
2546 9 50       77 unless ($top_el->hasAttribute($attr_name)) {
2547             $top_el->setAttribute
2548             ($attr_name,
2549 9         55 $token->{attributes}->{$attr_name}->{value});
2550             }
2551             }
2552            
2553 9         301 $token = $self->_get_next_token;
2554 9         23 next B;
2555             } elsif ($token->{type} == COMMENT_TOKEN) {
2556 43         422 my $comment = $self->{document}->createComment ($token->{data});
2557             $self->_data($comment, manakai_source_line => $token->{line})
2558 43 50       250 if defined $token->{line};
2559             $self->_data($comment, manakai_source_column => $token->{column})
2560 43 50       175 if defined $token->{column};
2561 43 100       191 if ($self->{insertion_mode} & AFTER_HTML_IMS) {
    100          
2562            
2563 8         48 $self->{document}->appendChild ($comment);
2564             } elsif ($self->{insertion_mode} == AFTER_BODY_IM) {
2565            
2566 1         7 $self->{open_elements}->[0]->[0]->appendChild($comment);
2567             } else {
2568 34         203 $self->{open_elements}->[-1]->[0]->appendChild($comment);
2569 34 50       188 $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
2570             }
2571 43         166 $token = $self->_get_next_token;
2572 43         173 next B;
2573             } elsif ($self->{insertion_mode} & IN_CDATA_RCDATA_IM) {
2574 510 100       1274 if ($token->{type} == CHARACTER_TOKEN) {
    100          
    50          
2575 414 100       915 $token->{data} =~ s/^\x0A// if $self->{ignore_newline};
2576 414         671 delete $self->{ignore_newline};
2577              
2578 414 100       821 if (length $token->{data}) {
2579            
2580             ## NOTE: NULLs are replaced into U+FFFDs in tokenizer.
2581             $self->{open_elements}->[-1]->[0]->appendTextFromUnicode
2582 412         1090 ($self, $token->{data}, $token);
2583             } else {
2584            
2585             }
2586 414         1703 $token = $self->_get_next_token;
2587 414         813 next B;
2588             } elsif ($token->{type} == END_TAG_TOKEN) {
2589 76         169 delete $self->{ignore_newline};
2590              
2591 76 100       213 if ($token->{tag_name} eq 'script') {
2592            
2593            
2594             ## Para 1-2
2595 29         48 my $script = pop @{$self->{open_elements}};
  29         74  
2596            
2597             ## Para 3
2598 29         60 $self->{insertion_mode} &= ~ IN_CDATA_RCDATA_IM;
2599              
2600             ## Para 4
2601             ## TODO: $old_insertion_point = $current_insertion_point;
2602             ## TODO: $current_insertion_point = just before $self->{nc};
2603              
2604             ## Para 5
2605             ## TODO: Run the $script->[0].
2606              
2607             ## Para 6
2608             ## TODO: $current_insertion_point = $old_insertion_point;
2609              
2610             ## Para 7
2611             ## TODO: if ($pending_external_script) {
2612             ## TODO: ...
2613             ## TODO: }
2614              
2615 29         91 $token = $self->_get_next_token;
2616 29         138 next B;
2617             } else {
2618            
2619            
2620 47         82 pop @{$self->{open_elements}};
  47         105  
2621              
2622 47         194 $self->{insertion_mode} &= ~ IN_CDATA_RCDATA_IM;
2623 47         853 $token = $self->_get_next_token;
2624 47         109 next B;
2625             }
2626             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
2627 20         44 delete $self->{ignore_newline};
2628              
2629            
2630             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
2631 20         154 text => $self->{open_elements}->[-1]->[0]
2632             ->localname,
2633             token => $token);
2634              
2635             #if ($self->{open_elements}->[-1]->[1] == SCRIPT_EL) {
2636             # ## TODO: Mark as "already executed"
2637             #}
2638              
2639 20         42 pop @{$self->{open_elements}};
  20         82  
2640            
2641 20         71 $self->{insertion_mode} &= ~ IN_CDATA_RCDATA_IM;
2642             ## Reprocess.
2643 20         331 next B;
2644             } else {
2645 0         0 die "$0: $token->{type}: In CDATA/RCDATA: Unknown token type";
2646             }
2647             } # insertion_mode
2648              
2649             # BEGIN:TOBYINK
2650 4292 100 100     10492 if ($self->{insertion_mode} == IN_HEAD_IM and
      100        
      100        
      66        
2651             ($token->{tag_name}||'') eq 'object' and
2652             $token->{type} == END_TAG_TOKEN and
2653             $self->_data($self->{'document'}, 'isHTML4')) {
2654            
2655 1         3 pop @{$self->{open_elements}}
2656 1 50       10 if $self->{open_elements}->[-1]->[0]->localname eq 'object';
2657             }
2658             # END:TOBYINK
2659              
2660 4292 100       13234 if ($self->{insertion_mode} & HEAD_IMS) {
    100          
    100          
    100          
    100          
    100          
    50          
2661 811 100       2467 if ($token->{type} == CHARACTER_TOKEN) {
    100          
    100          
    50          
2662 198 100       939 if ($token->{data} =~ s/^([\x09\x0A\x0C\x20]+)//) {
2663 19 100       75 unless ($self->{insertion_mode} == BEFORE_HEAD_IM) {
2664            
2665 11         109 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $1, $token);
2666             } else {
2667            
2668             ## Ignore the token.
2669             #
2670             }
2671 19 100       104 unless (length $token->{data}) {
2672            
2673 18         74 $token = $self->_get_next_token;
2674 18         52 next B;
2675             }
2676             ## TODO: set $token->{column} appropriately
2677             }
2678              
2679 180 100       402 if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
    50          
    100          
2680            
2681             ## As if
2682            
2683 176         1343 $self->{head_element} = $self->{document}->createElementNS((HTML_NS), 'head');
2684            
2685             $self->_data($self->{head_element}, manakai_source_line => $token->{line})
2686 176 50       895 if defined $token->{line};
2687             $self->_data($self->{head_element}, manakai_source_column => $token->{column})
2688 176 50       714 if defined $token->{column};
2689 176         511 $self->_data($self->{head_element}, implied => __LINE__);
2690            
2691 176         1180 $self->{open_elements}->[-1]->[0]->appendChild ($self->{head_element});
2692 176         2908 push @{$self->{open_elements}},
2693 176         719 [$self->{head_element}, $el_category->{head}];
2694              
2695             ## Reprocess in the "in head" insertion mode...
2696 176         304 pop @{$self->{open_elements}};
  176         331  
2697              
2698             ## Reprocess in the "after head" insertion mode...
2699             } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
2700            
2701             ## As if
2702 0         0 pop @{$self->{open_elements}};
  0         0  
2703 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in noscript:#text', token => $token);
2704            
2705             ## Reprocess in the "in head" insertion mode...
2706             ## As if
2707 0         0 pop @{$self->{open_elements}};
  0         0  
2708              
2709             ## Reprocess in the "after head" insertion mode...
2710             } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
2711            
2712 2         3 pop @{$self->{open_elements}};
  2         407  
2713              
2714             ## Reprocess in the "after head" insertion mode...
2715             } else {
2716            
2717             }
2718              
2719             ## "after head" insertion mode
2720             ## As if
2721            
2722             {
2723 180         401 my $el;
  180         306  
2724            
2725 180         1169 $el = $self->{document}->createElementNS((HTML_NS), 'body');
2726            
2727             $self->_data($el, manakai_source_line => $token->{line})
2728 180 50       821 if defined $token->{line};
2729             $self->_data($el, manakai_source_column => $token->{column})
2730 180 50       744 if defined $token->{column};
2731 180         454 $self->_data($el, implied => __LINE__);
2732            
2733 180         1034 $self->{open_elements}->[-1]->[0]->appendChild ($el);
2734 180   50     530 push @{$self->{open_elements}}, [$el, $el_category->{'body'} || 0];
  180         2527  
2735             }
2736            
2737 180         399 $self->{insertion_mode} = IN_BODY_IM;
2738             ## The "frameset-ok" flag is left unchanged in this case.
2739             ## Reporcess the token.
2740 180         381 next B;
2741             } elsif ($token->{type} == START_TAG_TOKEN) {
2742 536 100       1933 if ($token->{tag_name} eq 'head') {
    100          
2743 28 100       107 if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
    50          
2744            
2745            
2746 26         214 $self->{head_element} = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
2747            
2748 26         65 for my $attr_name (keys %{ $token->{attributes}}) {
  26         106  
2749 1         4 my $attr_t = $token->{attributes}->{$attr_name};
2750 1         9 my $attr = $self->{document}->createAttributeNS (undef, $attr_name);
2751 1         6 $attr->setValue ($attr_t->{value});
2752 1         5 $self->_data($attr,manakai_source_line => $attr_t->{line});
2753 1         6 $self->_data($attr,manakai_source_column => $attr_t->{column});
2754 1         10 $self->{head_element}->setAttributeNodeNS ($attr);
2755             }
2756            
2757             $self->_data($self->{head_element}, manakai_source_line => $token->{line})
2758 26 50       132 if defined $token->{line};
2759             $self->_data($self->{head_element}, manakai_source_column => $token->{column})
2760 26 50       131 if defined $token->{column};
2761            
2762 26         194 $self->{open_elements}->[-1]->[0]->appendChild($self->{head_element});
2763 26         486 push @{$self->{open_elements}},
2764 26         106 [$self->{head_element}, $el_category->{head}];
2765 26         60 $self->{insertion_mode} = IN_HEAD_IM;
2766            
2767 26         100 $token = $self->_get_next_token;
2768 26         67 next B;
2769             } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {
2770            
2771 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'after head', text => 'head',
2772             token => $token);
2773             ## Ignore the token
2774            
2775 0         0 $token = $self->_get_next_token;
2776 0         0 next B;
2777             } else {
2778            
2779 2         15 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in head:head',
2780             token => $token); # or in head noscript
2781             ## Ignore the token
2782            
2783 2         16 $token = $self->_get_next_token;
2784 2         16 next B;
2785             }
2786             } elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) {
2787            
2788             ## As if
2789            
2790 477         3977 $self->{head_element} = $self->{document}->createElementNS((HTML_NS), 'head');
2791            
2792             $self->_data($self->{head_element}, manakai_source_line => $token->{line})
2793 477 50       2384 if defined $token->{line};
2794             $self->_data($self->{head_element}, manakai_source_column => $token->{column})
2795 477 50       1897 if defined $token->{column};
2796 477         1343 $self->_data($self->{head_element}, implied => __LINE__);
2797            
2798 477         3352 $self->{open_elements}->[-1]->[0]->appendChild ($self->{head_element});
2799 477         8983 push @{$self->{open_elements}},
2800 477         2053 [$self->{head_element}, $el_category->{head}];
2801              
2802 477         1014 $self->{insertion_mode} = IN_HEAD_IM;
2803             ## Reprocess in the "in head" insertion mode...
2804             } else {
2805            
2806             }
2807              
2808 508 50 66     9513 if ($token->{tag_name} eq 'base') {
    100 100        
    50 66        
    100 100        
    100          
    100          
    50          
    100          
    100          
    100          
2809 0 0       0 if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
2810            
2811             ## As if
2812 0         0 pop @{$self->{open_elements}};
  0         0  
2813 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in noscript', text => 'base',
2814             token => $token);
2815            
2816 0         0 $self->{insertion_mode} = IN_HEAD_IM;
2817             ## Reprocess in the "in head" insertion mode...
2818             } else {
2819            
2820             }
2821              
2822             ## NOTE: There is a "as if in head" code clone.
2823 0 0       0 if ($self->{insertion_mode} == AFTER_HEAD_IM) {
2824            
2825             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after head',
2826 0         0 text => $token->{tag_name}, token => $token);
2827 0         0 push @{$self->{open_elements}},
2828 0         0 [$self->{head_element}, $el_category->{head}];
2829             } else {
2830            
2831             }
2832            
2833             {
2834 0         0 my $el;
  0         0  
2835            
2836 0         0 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
2837            
2838 0         0 for my $attr_name (keys %{ $token->{attributes}}) {
  0         0  
2839 0         0 my $attr_t = $token->{attributes}->{$attr_name};
2840 0         0 my $attr = $self->{document}->createAttributeNS (undef, $attr_name);
2841 0         0 $attr->setValue ($attr_t->{value});
2842 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
2843 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
2844 0         0 $el->setAttributeNodeNS($attr);
2845             }
2846            
2847             $self->_data($el,manakai_source_line => $token->{line})
2848 0 0       0 if defined $token->{line};
2849             $self->_data($el,manakai_source_column => $token->{column})
2850 0 0       0 if defined $token->{column};
2851            
2852 0         0 $self->{open_elements}->[-1]->[0]->appendChild ($el);
2853 0   0     0 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  0         0  
2854             }
2855            
2856 0         0 pop @{$self->{open_elements}};
  0         0  
2857 0         0 pop @{$self->{open_elements}} #
2858 0 0       0 if $self->{insertion_mode} == AFTER_HEAD_IM;
2859            
2860 0         0 $token = $self->_get_next_token;
2861 0         0 next B;
2862             } elsif ({
2863             link => 1, basefont => 1, bgsound => 1,
2864             }->{$token->{tag_name}}) {
2865             ## NOTE: There is a "as if in head" code clone.
2866 2 50       8 if ($self->{insertion_mode} == AFTER_HEAD_IM) {
2867            
2868             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after head',
2869 0         0 text => $token->{tag_name}, token => $token);
2870 0         0 push @{$self->{open_elements}},
2871 0         0 [$self->{head_element}, $el_category->{head}];
2872             } else {
2873            
2874             }
2875            
2876             {
2877 2         4 my $el;
  2         5  
2878            
2879 2         13 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
2880            
2881 2         6 for my $attr_name (keys %{ $token->{attributes}}) {
  2         18  
2882 0         0 my $attr_t = $token->{attributes}->{$attr_name};
2883 0         0 my $attr = $self->{document}->createAttributeNS (undef, $attr_name);
2884 0         0 $attr->setValue($attr_t->{value});
2885 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
2886 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
2887 0         0 $el->setAttributeNodeNS($attr);
2888             }
2889            
2890             $self->_data($el, manakai_source_line => $token->{line})
2891 2 50       14 if defined $token->{line};
2892             $self->_data($el, manakai_source_column => $token->{column})
2893 2 50       8 if defined $token->{column};
2894            
2895 2         12 $self->{open_elements}->[-1]->[0]->appendChild ($el);
2896 2   50     7 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  2         44  
2897             }
2898            
2899 2         4 pop @{$self->{open_elements}};
  2         4  
2900 0         0 pop @{$self->{open_elements}} #
2901 2 50       7 if $self->{insertion_mode} == AFTER_HEAD_IM;
2902 2         24 delete $self->{self_closing};
2903 2         9 $token = $self->_get_next_token;
2904 2         7 next B;
2905             } elsif ($token->{tag_name} eq 'command') {
2906 0 0       0 if ($self->{insertion_mode} == IN_HEAD_IM) {
2907             ## NOTE: If the insertion mode at the time of the emission
2908             ## of the token was "before head", $self->{insertion_mode}
2909             ## is already changed to |IN_HEAD_IM|.
2910              
2911             ## NOTE: There is a "as if in head" code clone.
2912            
2913             {
2914 0         0 my $el;
  0         0  
2915            
2916 0         0 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
2917            
2918 0         0 for my $attr_name (keys %{ $token->{attributes}}) {
  0         0  
2919 0         0 my $attr_t = $token->{attributes}->{$attr_name};
2920 0         0 my $attr = $self->{document}->createAttributeNS (undef, $attr_name);
2921 0         0 $attr->setValue($attr_t->{value});
2922 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
2923 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
2924 0         0 $el->setAttributeNodeNS($attr);
2925             }
2926            
2927             $self->_data($el, manakai_source_line => $token->{line})
2928 0 0       0 if defined $token->{line};
2929             $self->_data($el, manakai_source_column => $token->{column})
2930 0 0       0 if defined $token->{column};
2931            
2932 0         0 $self->{open_elements}->[-1]->[0]->appendChild ($el);
2933 0   0     0 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  0         0  
2934             }
2935            
2936 0         0 pop @{$self->{open_elements}};
  0         0  
2937 0         0 pop @{$self->{open_elements}} #
2938 0 0       0 if $self->{insertion_mode} == AFTER_HEAD_IM;
2939 0         0 delete $self->{self_closing};
2940 0         0 $token = $self->_get_next_token;
2941 0         0 next B;
2942             } else {
2943             ## NOTE: "in head noscript" or "after head" insertion mode
2944             ## - in these cases, these tags are treated as same as
2945             ## normal in-body tags.
2946            
2947             #
2948             }
2949             } elsif ($token->{tag_name} eq 'meta') {
2950             ## NOTE: There is a "as if in head" code clone.
2951 7 50       24 if ($self->{insertion_mode} == AFTER_HEAD_IM) {
2952            
2953             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after head',
2954 0         0 text => $token->{tag_name}, token => $token);
2955 0         0 push @{$self->{open_elements}},
2956 0         0 [$self->{head_element}, $el_category->{head}];
2957             } else {
2958            
2959             }
2960            
2961             {
2962 7         13 my $el;
  7         10  
2963            
2964 7         63 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
2965            
2966 7         16 for my $attr_name (keys %{ $token->{attributes}}) {
  7         30  
2967 8         17 my $attr_t = $token->{attributes}->{$attr_name};
2968 8         44 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
2969 8         36 $attr->setValue ($attr_t->{value});
2970 8         24 $self->_data($attr, manakai_source_line => $attr_t->{line});
2971 8         23 $self->_data($attr, manakai_source_column => $attr_t->{column});
2972 8         49 $el->setAttributeNodeNS ($attr);
2973             }
2974            
2975             $self->_data($el, manakai_source_line => $token->{line})
2976 7 50       34 if defined $token->{line};
2977             $self->_data($el, manakai_source_column => $token->{column})
2978 7 50       48 if defined $token->{column};
2979            
2980 7         52 $self->{open_elements}->[-1]->[0]->appendChild ($el);
2981 7   50     26 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  7         133  
2982             }
2983            
2984 7         13 my $meta_el = pop @{$self->{open_elements}};
  7         19  
2985              
2986 7 100       22 unless ($self->{confident}) {
2987 4 100 66     25 if ($token->{attributes}->{charset}) {
    100          
2988            
2989             ## NOTE: Whether the encoding is supported or not,
2990             ## an ASCII-compatible charset is not, is handled in
2991             ## the {change_encoding} callback.
2992             $self->{change_encoding}
2993             ->($self, $token->{attributes}->{charset}->{value},
2994 2         8 $token);
2995            
2996             $self->_data($meta_el->[0]->getAttributeNodeNS (undef, 'charset'),
2997 0         0 manakai_has_reference => $token->{attributes}->{charset}->{has_reference});
2998             } elsif ($token->{attributes}->{content} and
2999             $token->{attributes}->{'http-equiv'}) {
3000 1 50 33     17 if ($token->{attributes}->{'http-equiv'}->{value}
3001             =~ /\A[Cc][Oo][Nn][Tt][Ee][Nn][Tt]-[Tt][Yy][Pp][Ee]\z/ and
3002             $token->{attributes}->{content}->{value}
3003             =~ /[Cc][Hh][Aa][Rr][Ss][Ee][Tt]
3004             [\x09\x0A\x0C\x0D\x20]*=
3005             [\x09\x0A\x0C\x0D\x20]*(?>"([^"]*)"|'([^']*)'|
3006             ([^"'\x09\x0A\x0C\x0D\x20]
3007             [^\x09\x0A\x0C\x0D\x20\x3B]*))/x) {
3008              
3009             ## NOTE: Whether the encoding is supported or not,
3010             ## an ASCII-compatible charset is not, is handled
3011             ## in the {change_encoding} callback.
3012             $self->{change_encoding}
3013 1 50       22 ->($self, defined $1 ? $1 : defined $2 ? $2 : $3,
    50          
3014             $token);
3015             $self->_data($meta_el->[0]->getAttributeNodeNS (undef, 'content'),
3016 0         0 manakai_has_reference => $token->{attributes}->{content}->{has_reference});
3017             } else {
3018            
3019             }
3020             }
3021             } else {
3022 3 100       11 if ($token->{attributes}->{charset}) {
3023            
3024             $self->_data($meta_el->[0]->getAttributeNodeNS(undef, 'charset'),
3025 2         16 manakai_has_reference => $token->{attributes}->{charset}->{has_reference});
3026             }
3027 3 100       15 if ($token->{attributes}->{content}) {
3028            
3029             $self->_data($meta_el->[0]->getAttributeNodeNS(undef, 'content'),
3030 1         9 manakai_has_reference => $token->{attributes}->{content}->{has_reference});
3031             }
3032             }
3033              
3034 0         0 pop @{$self->{open_elements}} #
3035 4 50       15 if $self->{insertion_mode} == AFTER_HEAD_IM;
3036 4         9 delete $self->{self_closing};
3037 4         18 $token = $self->_get_next_token;
3038 4         20 next B;
3039             } elsif ($token->{tag_name} eq 'title') {
3040 11 50       100 if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
    100          
3041            
3042             ## As if
3043 0         0 pop @{$self->{open_elements}};
  0         0  
3044 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in noscript', text => 'title',
3045             token => $token);
3046            
3047 0         0 $self->{insertion_mode} = IN_HEAD_IM;
3048             ## Reprocess in the "in head" insertion mode...
3049             } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {
3050            
3051             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after head',
3052 2         12 text => $token->{tag_name}, token => $token);
3053 2         6 push @{$self->{open_elements}},
3054 2         4 [$self->{head_element}, $el_category->{head}];
3055             } else {
3056            
3057             }
3058              
3059             ## NOTE: There is a "as if in head" code clone.
3060 11         97 $parse_rcdata->($self, $insert, $open_tables, 1); # RCDATA
3061              
3062             ## NOTE: At this point the stack of open elements contain
3063             ## the |head| element (index == -2) and the |script| element
3064             ## (index == -1). In the "after head" insertion mode the
3065             ## |head| element is inserted only for the purpose of
3066             ## providing the context for the |script| element, and
3067             ## therefore we can now and have to remove the element from
3068             ## the stack.
3069 2         6 splice @{$self->{open_elements}}, -2, 1, () #
3070 11 100       67 if ($self->{insertion_mode} & IM_MASK) == AFTER_HEAD_IM;
3071 11         46 next B;
3072             } elsif ($token->{tag_name} eq 'style' or
3073             $token->{tag_name} eq 'noframes') {
3074             ## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and
3075             ## insertion mode IN_HEAD_IM)
3076             ## NOTE: There is a "as if in head" code clone.
3077 6 100       41 if ($self->{insertion_mode} == AFTER_HEAD_IM) {
3078            
3079             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after head',
3080 3         21 text => $token->{tag_name}, token => $token);
3081 3         13 push @{$self->{open_elements}},
3082 3         8 [$self->{head_element}, $el_category->{head}];
3083             } else {
3084            
3085             }
3086 6         36 $parse_rcdata->($self, $insert, $open_tables, 0); # RAWTEXT
3087 3         12 splice @{$self->{open_elements}}, -2, 1, () #
3088 6 100       34 if ($self->{insertion_mode} & IM_MASK) == AFTER_HEAD_IM;
3089 6         19 next B;
3090             } elsif ($token->{tag_name} eq 'noscript') {
3091 0 0       0 if ($self->{insertion_mode} == IN_HEAD_IM) {
    0          
3092            
3093             ## NOTE: and scripting is disalbed
3094            
3095             {
3096 0         0 my $el;
  0         0  
3097            
3098 0         0 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
3099            
3100 0         0 for my $attr_name (keys %{ $token->{attributes}}) {
  0         0  
3101 0         0 my $attr_t = $token->{attributes}->{$attr_name};
3102 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
3103 0         0 $attr->setValue ($attr_t->{value});
3104 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
3105 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
3106 0         0 $el->setAttributeNodeNS ($attr);
3107             }
3108            
3109             $self->_data($el, manakai_source_line => $token->{line})
3110 0 0       0 if defined $token->{line};
3111             $self->_data($el, manakai_source_column => $token->{column})
3112 0 0       0 if defined $token->{column};
3113            
3114 0         0 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3115 0   0     0 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  0         0  
3116             }
3117            
3118 0         0 $self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM;
3119            
3120 0         0 $token = $self->_get_next_token;
3121 0         0 next B;
3122             } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
3123            
3124 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in noscript', text => 'noscript',
3125             token => $token);
3126             ## Ignore the token
3127            
3128 0         0 $token = $self->_get_next_token;
3129 0         0 next B;
3130             } else {
3131            
3132             #
3133             }
3134             } elsif ($token->{tag_name} eq 'script') {
3135 5 50       26 if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
    100          
3136            
3137             ## As if
3138 0         0 pop @{$self->{open_elements}};
  0         0  
3139 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in noscript', text => 'script',
3140             token => $token);
3141            
3142 0         0 $self->{insertion_mode} = IN_HEAD_IM;
3143             ## Reprocess in the "in head" insertion mode...
3144             } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {
3145            
3146             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after head',
3147 2         11 text => $token->{tag_name}, token => $token);
3148 2         6 push @{$self->{open_elements}},
3149 2         4 [$self->{head_element}, $el_category->{head}];
3150             } else {
3151            
3152             }
3153              
3154             ## NOTE: There is a "as if in head" code clone.
3155 5         20 $script_start_tag->($self, $insert, $open_tables);
3156             ## ISSUE: A spec bug [Bug 6038]
3157 2         6 splice @{$self->{open_elements}}, -2, 1 #
3158 5 100       22 if ($self->{insertion_mode} & IM_MASK) == AFTER_HEAD_IM;
3159 5         19 next B;
3160             } elsif ($token->{tag_name} eq 'body' or
3161             $token->{tag_name} eq 'frameset') {
3162 119 50       549 if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
    100          
3163            
3164             ## As if
3165 0         0 pop @{$self->{open_elements}};
  0         0  
3166             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in noscript',
3167 0         0 text => $token->{tag_name}, token => $token);
3168            
3169             ## Reprocess in the "in head" insertion mode...
3170             ## As if
3171 0         0 pop @{$self->{open_elements}};
  0         0  
3172            
3173             ## Reprocess in the "after head" insertion mode...
3174             } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
3175            
3176 109         192 pop @{$self->{open_elements}};
  109         273  
3177            
3178             ## Reprocess in the "after head" insertion mode...
3179             } else {
3180            
3181             }
3182              
3183             ## "after head" insertion mode
3184            
3185             {
3186 119         297 my $el;
  119         246  
3187            
3188 119         849 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
3189            
3190 119         287 for my $attr_name (keys %{ $token->{attributes}}) {
  119         615  
3191 9         26 my $attr_t = $token->{attributes}->{$attr_name};
3192 9         77 my $attr = $self->{document}->createAttributeNS (undef, $attr_name);
3193 9         50 $attr->setValue ($attr_t->{value});
3194 9         33 $self->_data($attr, manakai_source_line => $attr_t->{line});
3195 9         31 $self->_data($attr, manakai_source_column => $attr_t->{column});
3196 9         78 $el->setAttributeNodeNS ($attr);
3197             }
3198            
3199             $self->_data($el, manakai_source_line => $token->{line})
3200 119 50       621 if defined $token->{line};
3201             $self->_data($el, manakai_source_column => $token->{column})
3202 119 50       522 if defined $token->{column};
3203            
3204 119         748 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3205 119   50     376 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  119         1913  
3206             }
3207            
3208 119 100       431 if ($token->{tag_name} eq 'body') {
    50          
3209            
3210 100         222 delete $self->{frameset_ok};
3211 100         238 $self->{insertion_mode} = IN_BODY_IM;
3212             } elsif ($token->{tag_name} eq 'frameset') {
3213            
3214 19         34 $self->{insertion_mode} = IN_FRAMESET_IM;
3215             } else {
3216 0         0 die "$0: tag name: $self->{tag_name}";
3217             }
3218            
3219 119         428 $token = $self->_get_next_token;
3220 119         392 next B;
3221             # BEGIN:TOBYINK
3222             } elsif ($self->{insertion_mode} == IN_HEAD_IM and
3223             $token->{tag_name} =~ m'^(object|param)$' and
3224             $self->_data($self->{'document'}, 'isHTML4')) {
3225             {
3226 1         2 my $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
  1         9  
3227 1         2 for my $attr_name (keys %{ $token->{attributes}}) {
  1         6  
3228 0         0 my $attr_t = $token->{attributes}->{$attr_name};
3229 0         0 my $attr = $self->{document}->createAttributeNS (undef, $attr_name);
3230 0         0 $attr->setValue($attr_t->{value});
3231 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
3232 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
3233 0         0 $el->setAttributeNodeNS($attr);
3234             }
3235 1 50       6 $self->_data($el, manakai_source_line => $token->{line}) if defined $token->{line};
3236 1 50       6 $self->_data($el, manakai_source_column => $token->{column}) if defined $token->{column};
3237 1         8 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3238 1   50     4 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  1         19  
3239             }
3240 1 50       4 if ($token->{tag_name} eq 'param')
3241             {
3242 0         0 pop @{$self->{open_elements}};
  0         0  
3243 0         0 delete $self->{self_closing};
3244             }
3245 1         4 $token = $self->_get_next_token;
3246 1         4 next B;
3247             # END:TOBYINK
3248             } else {
3249             #
3250             }
3251              
3252 357 50       1509 if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
    50          
3253            
3254             ## As if
3255 0         0 pop @{$self->{open_elements}};
  0         0  
3256             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in noscript:/',
3257 0         0 text => $token->{tag_name}, token => $token);
3258            
3259             ## Reprocess in the "in head" insertion mode...
3260             ## As if
3261 0         0 pop @{$self->{open_elements}};
  0         0  
3262              
3263             ## Reprocess in the "after head" insertion mode...
3264             } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
3265            
3266             ## As if
3267 357         651 pop @{$self->{open_elements}};
  357         925  
3268              
3269             ## Reprocess in the "after head" insertion mode...
3270             } else {
3271            
3272             }
3273              
3274             ## "after head" insertion mode
3275             ## As if
3276            
3277             {
3278 357         684 my $el;
  357         546  
3279            
3280 357         2357 $el = $self->{document}->createElementNS((HTML_NS), 'body');
3281            
3282             $self->_data($el, manakai_source_line => $token->{line})
3283 357 50       1667 if defined $token->{line};
3284             $self->_data($el, manakai_source_column => $token->{column})
3285 357 50       1281 if defined $token->{column};
3286 357         934 $self->_data($el, implied => __LINE__);
3287            
3288 357         1930 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3289 357   50     1107 push @{$self->{open_elements}}, [$el, $el_category->{'body'} || 0];
  357         5209  
3290             }
3291 357         716 $self->{insertion_mode} = IN_BODY_IM;
3292             ## The "frameset-ok" flag is not changed in this case.
3293             ## Reprocess the token.
3294            
3295 357         795 next B;
3296             } elsif ($token->{type} == END_TAG_TOKEN) {
3297             ## "Before head", "in head", and "after head" insertion modes
3298             ## ignore most of end tags. Exceptions are "body", "html",
3299             ## and "br" end tags. "Before head" and "in head" insertion
3300             ## modes also recognize "head" end tag. "In head noscript"
3301             ## insertion modes ignore end tags except for "noscript" and
3302             ## "br".
3303              
3304 34 100       206 if ($token->{tag_name} eq 'head') {
    50          
    100          
3305 22 100       113 if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
    50          
    50          
    0          
3306            
3307             ## As if
3308            
3309 1         11 $self->{head_element} = $self->{document}->createElementNS((HTML_NS), 'head');
3310            
3311             $self->_data($self->{head_element}, manakai_source_line => $token->{line})
3312 1 50       17 if defined $token->{line};
3313             $self->_data($self->{head_element}, manakai_source_column => $token->{column})
3314 1 50       7 if defined $token->{column};
3315            
3316 1         8 $self->{open_elements}->[-1]->[0]->appendChild($self->{head_element});
3317 1         17 push @{$self->{open_elements}},
3318 1         4 [$self->{head_element}, $el_category->{head}];
3319              
3320             ## Reprocess in the "in head" insertion mode...
3321 1         3 pop @{$self->{open_elements}};
  1         3  
3322 1         3 $self->{insertion_mode} = AFTER_HEAD_IM;
3323 1         4 $token = $self->_get_next_token;
3324 1         3 next B;
3325             } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
3326            
3327             #
3328             } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
3329            
3330 21         36 pop @{$self->{open_elements}};
  21         48  
3331 21         53 $self->{insertion_mode} = AFTER_HEAD_IM;
3332 21         74 $token = $self->_get_next_token;
3333 21         60 next B;
3334             } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {
3335            
3336             #
3337             } else {
3338 0         0 die "$0: $self->{insertion_mode}: Unknown insertion mode";
3339             }
3340             } elsif ($token->{tag_name} eq 'noscript') {
3341 0 0       0 if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
3342            
3343 0         0 pop @{$self->{open_elements}};
  0         0  
3344 0         0 $self->{insertion_mode} = IN_HEAD_IM;
3345 0         0 $token = $self->_get_next_token;
3346 0         0 next B;
3347             } else {
3348            
3349             #
3350             }
3351             } elsif ({
3352             body => ($self->{insertion_mode} != IN_HEAD_NOSCRIPT_IM),
3353             html => ($self->{insertion_mode} != IN_HEAD_NOSCRIPT_IM),
3354             br => 1,
3355             }->{$token->{tag_name}}) {
3356 9 100       37 if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
    50          
    50          
    50          
3357            
3358             ## (before head) as if , (in head) as if
3359            
3360 7         62 $self->{head_element} = $self->{document}->createElementNS((HTML_NS), 'head');
3361            
3362             $self->_data($self->{head_element}, manakai_source_line => $token->{line})
3363 7 50       40 if defined $token->{line};
3364             $self->_data($self->{head_element}, manakai_source_column => $token->{column})
3365 7 50       53 if defined $token->{column};
3366 7         31 $self->_data($self->{head_element}, implied => __LINE__);
3367            
3368 7         64 $self->{open_elements}->[-1]->[0]->appendChild ($self->{head_element});
3369 7         28 $self->{insertion_mode} = AFTER_HEAD_IM;
3370            
3371             ## Reprocess in the "after head" insertion mode...
3372             } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
3373            
3374             ## As if
3375 0         0 pop @{$self->{open_elements}};
  0         0  
3376 0         0 $self->{insertion_mode} = AFTER_HEAD_IM;
3377            
3378             ## Reprocess in the "after head" insertion mode...
3379             } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
3380            
3381             ## NOTE: Two parse errors for
3382             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3383 0         0 text => $token->{tag_name}, token => $token);
3384             ## As if
3385 0         0 pop @{$self->{open_elements}};
  0         0  
3386 0         0 $self->{insertion_mode} = IN_HEAD_IM;
3387              
3388             ## Reprocess in the "in head" insertion mode...
3389             ## As if
3390 0         0 pop @{$self->{open_elements}};
  0         0  
3391 0         0 $self->{insertion_mode} = AFTER_HEAD_IM;
3392              
3393             ## Reprocess in the "after head" insertion mode...
3394             } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {
3395            
3396             #
3397             } else {
3398 0         0 die "$0: $self->{insertion_mode}: Unknown insertion mode";
3399             }
3400              
3401             ## "after head" insertion mode
3402             ## As if
3403            
3404             {
3405 9         171 my $el;
  9         16  
3406            
3407 9         70 $el = $self->{document}->createElementNS((HTML_NS), 'body');
3408            
3409             $self->_data($el, manakai_source_line => $token->{line})
3410 9 50       57 if defined $token->{line};
3411             $self->_data($el, manakai_source_column => $token->{column})
3412 9 50       56 if defined $token->{column};
3413 9         37 $self->_data($el, implied => __LINE__);
3414            
3415 9         62 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3416 9   50     32 push @{$self->{open_elements}}, [$el, $el_category->{'body'} || 0];
  9         144  
3417             }
3418            
3419 9         20 $self->{insertion_mode} = IN_BODY_IM;
3420             ## The "frameset-ok" flag is left unchanged in this case.
3421             ## Reprocess the token.
3422 9         30 next B;
3423             }
3424              
3425             ## End tags are ignored by default.
3426            
3427             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3428 3         17 text => $token->{tag_name}, token => $token);
3429             ## Ignore the token.
3430 3         11 $token = $self->_get_next_token;
3431 3         8 next B;
3432             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
3433 43 100       177 if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
    100          
    50          
3434            
3435              
3436             ## NOTE: As if
3437            
3438 24         193 $self->{head_element} = $self->{document}->createElementNS((HTML_NS), 'head');
3439            
3440             $self->_data($self->{head_element}, manakai_source_line => $token->{line})
3441 24 50       123 if defined $token->{line};
3442             $self->_data($self->{head_element}, manakai_source_column => $token->{column})
3443 24 50       121 if defined $token->{column};
3444 24         82 $self->_data($self->{head_element}, implied => __LINE__);
3445            
3446 24         170 $self->{open_elements}->[-1]->[0]->appendChild($self->{head_element});
3447            
3448             #push @{$self->{open_elements}},
3449             # [$self->{head_element}, $el_category->{head}];
3450             #$self->{insertion_mode} = IN_HEAD_IM;
3451             ## NOTE: Reprocess.
3452              
3453             ## NOTE: As if
3454             #pop @{$self->{open_elements}};
3455             #$self->{insertion_mode} = IN_AFTER_HEAD_IM;
3456             ## NOTE: Reprocess.
3457            
3458             #
3459             } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
3460            
3461              
3462             ## NOTE: As if
3463 11         18 pop @{$self->{open_elements}};
  11         28  
3464             #$self->{insertion_mode} = IN_AFTER_HEAD_IM;
3465             ## NOTE: Reprocess.
3466              
3467             #
3468             } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
3469            
3470              
3471 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in noscript:#eof', token => $token);
3472              
3473             ## As if
3474 0         0 pop @{$self->{open_elements}};
  0         0  
3475             #$self->{insertion_mode} = IN_HEAD_IM;
3476             ## NOTE: Reprocess.
3477              
3478             ## NOTE: As if
3479 0         0 pop @{$self->{open_elements}};
  0         0  
3480             #$self->{insertion_mode} = IN_AFTER_HEAD_IM;
3481             ## NOTE: Reprocess.
3482              
3483             #
3484             } else {
3485            
3486             #
3487             }
3488              
3489             ## NOTE: As if
3490            
3491             {
3492 43         137 my $el;
  43         372  
3493            
3494 43         335 $el = $self->{document}->createElementNS((HTML_NS), 'body');
3495            
3496             $self->_data($el, manakai_source_line => $token->{line})
3497 43 50       214 if defined $token->{line};
3498             $self->_data($el, manakai_source_column => $token->{column})
3499 43 50       204 if defined $token->{column};
3500 43         169 $self->_data($el, implied => __LINE__);
3501            
3502 43         276 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3503 43   50     133 push @{$self->{open_elements}}, [$el, $el_category->{'body'} || 0];
  43         698  
3504             }
3505            
3506 43         104 $self->{insertion_mode} = IN_BODY_IM;
3507             ## The "frameset-ok" flag is left unchanged in this case.
3508             ## Reprocess the token.
3509 43         90 next B;
3510             } else {
3511 0         0 die "$0: $token->{type}: Unknown token type";
3512             }
3513            
3514             } elsif ($self->{insertion_mode} & BODY_IMS) {
3515 2762 100       8573 if ($token->{type} == CHARACTER_TOKEN) {
    100          
    100          
    50          
3516             ## "In body" insertion mode, character token. It is also used
3517             ## for character tokens "in foreign content" insertion
3518             ## mode, for certain cases.
3519            
3520 705         2633 while ($token->{data} =~ s/\x00//g) {
3521 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'NULL', token => $token);
3522             }
3523 705 50       1678 if ($token->{data} eq '') {
3524 0         0 $token = $self->_get_next_token;
3525 0         0 next B;
3526             }
3527            
3528             $reconstruct_active_formatting_elements
3529 705         2336 ->($self, $insert_to_current, $active_formatting_elements, $open_tables);
3530            
3531 705         3095 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $token->{data}, $token);
3532              
3533 705 100 100     3768 if ($self->{frameset_ok} and
3534             $token->{data} =~ /[^\x09\x0A\x0C\x0D\x20]/) {
3535 237         562 delete $self->{frameset_ok};
3536             }
3537              
3538 705         2392 $token = $self->_get_next_token;
3539 705         1491 next B;
3540             } elsif ($token->{type} == START_TAG_TOKEN) {
3541 1078 100       8407 if ({
3542             caption => 1, col => 1, colgroup => 1, tbody => 1,
3543             td => 1, tfoot => 1, th => 1, thead => 1, tr => 1,
3544             }->{$token->{tag_name}}) {
3545 9 100       49 if (($self->{insertion_mode} & IM_MASK) == IN_CELL_IM) {
    100          
3546             ## have an element in table scope
3547 7         19 for (reverse 0..$#{$self->{open_elements}}) {
  7         27  
3548 12         27 my $node = $self->{open_elements}->[$_];
3549 12 100       54 if ($node->[1] == TABLE_CELL_EL) {
    50          
3550            
3551              
3552             ## Close the cell
3553            
3554 7         20 $token->{self_closing} = $self->{self_closing};
3555 7         14 unshift @{$self->{token}}, $token;
  7         20  
3556 7         13 delete $self->{self_closing};
3557             #
3558             $token = {type => END_TAG_TOKEN,
3559             tag_name => $node->[0]->tagName,
3560             line => $token->{line},
3561 7         75 column => $token->{column}};
3562 7         32 next B;
3563             } elsif ($node->[1] & TABLE_SCOPING_EL) {
3564            
3565             ## ISSUE: This case can never be reached, maybe.
3566 0         0 last;
3567             }
3568             }
3569              
3570            
3571             $self->{parse_error}->(level => $self->{level}->{must}, type => 'start tag not allowed',
3572 0         0 text => $token->{tag_name}, token => $token);
3573             ## Ignore the token
3574            
3575 0         0 $token = $self->_get_next_token;
3576 0         0 next B;
3577             } elsif (($self->{insertion_mode} & IM_MASK) == IN_CAPTION_IM) {
3578 1         6 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', text => 'caption',
3579             token => $token);
3580            
3581             ## NOTE: As if .
3582             ## have a table element in table scope
3583 1         2 my $i;
3584             INSCOPE: {
3585 1         2 for (reverse 0..$#{$self->{open_elements}}) {
  1         3  
  1         3  
3586 1         4 my $node = $self->{open_elements}->[$_];
3587 1 50       4 if ($node->[1] == CAPTION_EL) {
    0          
3588            
3589 1         2 $i = $_;
3590 1         3 last INSCOPE;
3591             } elsif ($node->[1] & TABLE_SCOPING_EL) {
3592            
3593 0         0 last;
3594             }
3595             }
3596              
3597            
3598             $self->{parse_error}->(level => $self->{level}->{must}, type => 'start tag not allowed',
3599 0         0 text => $token->{tag_name}, token => $token);
3600             ## Ignore the token
3601            
3602 0         0 $token = $self->_get_next_token;
3603 0         0 next B;
3604             } # INSCOPE
3605            
3606             ## generate implied end tags
3607 1         5 while ($self->{open_elements}->[-1]->[1]
3608             & END_TAG_OPTIONAL_EL) {
3609            
3610 0         0 pop @{$self->{open_elements}};
  0         0  
3611             }
3612              
3613 1 50       5 unless ($self->{open_elements}->[-1]->[1] == CAPTION_EL) {
3614            
3615             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
3616 0         0 text => $self->{open_elements}->[-1]->[0]->tagName,
3617             token => $token);
3618             } else {
3619            
3620             }
3621            
3622 1         3 splice @{$self->{open_elements}}, $i;
  1         3  
3623            
3624 1         16 $clear_up_to_marker->($active_formatting_elements);
3625            
3626 1         5 $self->{insertion_mode} = IN_TABLE_IM;
3627            
3628             ## reprocess
3629            
3630 1         4 next B;
3631             } else {
3632            
3633             #
3634             }
3635             } else {
3636            
3637             #
3638             }
3639             } elsif ($token->{type} == END_TAG_TOKEN) {
3640 393 100 100     5497 if ($token->{tag_name} eq 'td' or $token->{tag_name} eq 'th') {
    100 100        
    100 100        
    100 66        
    100          
    50          
3641 30 100       121 if (($self->{insertion_mode} & IM_MASK) == IN_CELL_IM) {
    50          
3642             ## have an element in table scope
3643 29         65 my $i;
3644 29         76 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  29         122  
3645 35         82 my $node = $self->{open_elements}->[$_];
3646 35 100       258 if ($node->[0]->tagName eq $token->{tag_name}) {
    50          
3647            
3648 29         72 $i = $_;
3649 29         81 last INSCOPE;
3650             } elsif ($node->[1] & TABLE_SCOPING_EL) {
3651            
3652 0         0 last INSCOPE;
3653             }
3654             } # INSCOPE
3655 29 50       90 unless (defined $i) {
3656            
3657             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3658             text => $token->{tag_name},
3659 0         0 token => $token);
3660             ## Ignore the token
3661 0         0 $token = $self->_get_next_token;
3662 0         0 next B;
3663             }
3664            
3665             ## generate implied end tags
3666 29         121 while ($self->{open_elements}->[-1]->[1]
3667             & END_TAG_OPTIONAL_EL) {
3668            
3669 1         3 pop @{$self->{open_elements}};
  1         6  
3670             }
3671              
3672 29 100       155 if ($self->{open_elements}->[-1]->[0]->tagName
3673             ne $token->{tag_name}) {
3674            
3675             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
3676 3         21 text => $self->{open_elements}->[-1]->[0]->tagName,
3677             token => $token);
3678             } else {
3679            
3680             }
3681            
3682 29         62 splice @{$self->{open_elements}}, $i;
  29         94  
3683            
3684 29         148 $clear_up_to_marker->($active_formatting_elements);
3685            
3686 29         64 $self->{insertion_mode} = IN_ROW_IM;
3687            
3688 29         112 $token = $self->_get_next_token;
3689 29         73 next B;
3690             } elsif (($self->{insertion_mode} & IM_MASK) == IN_CAPTION_IM) {
3691            
3692             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3693 0         0 text => $token->{tag_name}, token => $token);
3694             ## Ignore the token
3695 0         0 $token = $self->_get_next_token;
3696 0         0 next B;
3697             } else {
3698            
3699             #
3700             }
3701             } elsif ($token->{tag_name} eq 'caption') {
3702 4 100       25 if (($self->{insertion_mode} & IM_MASK) == IN_CAPTION_IM) {
    50          
3703             ## have a table element in table scope
3704 3         8 my $i;
3705             INSCOPE: {
3706 3         9 for (reverse 0..$#{$self->{open_elements}}) {
  3         12  
  3         14  
3707 4         13 my $node = $self->{open_elements}->[$_];
3708 4 100       19 if ($node->[1] == CAPTION_EL) {
    50          
3709            
3710 3         7 $i = $_;
3711 3         9 last INSCOPE;
3712             } elsif ($node->[1] & TABLE_SCOPING_EL) {
3713            
3714 0         0 last;
3715             }
3716             }
3717              
3718            
3719             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3720 0         0 text => $token->{tag_name}, token => $token);
3721             ## Ignore the token
3722 0         0 $token = $self->_get_next_token;
3723 0         0 next B;
3724             } # INSCOPE
3725            
3726             ## generate implied end tags
3727 3         15 while ($self->{open_elements}->[-1]->[1]
3728             & END_TAG_OPTIONAL_EL) {
3729            
3730 1         3 pop @{$self->{open_elements}};
  1         4  
3731             }
3732            
3733 3 50       31 unless ($self->{open_elements}->[-1]->[1] == CAPTION_EL) {
3734            
3735             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
3736 0         0 text => $self->{open_elements}->[-1]->[0]->tagName,
3737             token => $token);
3738             } else {
3739            
3740             }
3741            
3742 3         7 splice @{$self->{open_elements}}, $i;
  3         29  
3743            
3744 3         16 $clear_up_to_marker->($active_formatting_elements);
3745            
3746 3         11 $self->{insertion_mode} = IN_TABLE_IM;
3747            
3748 3         26 $token = $self->_get_next_token;
3749 3         10 next B;
3750             } elsif (($self->{insertion_mode} & IM_MASK) == IN_CELL_IM) {
3751            
3752             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3753 1         6 text => $token->{tag_name}, token => $token);
3754             ## Ignore the token
3755 1         5 $token = $self->_get_next_token;
3756 1         3 next B;
3757             } else {
3758            
3759             #
3760             }
3761             } elsif ({
3762             table => 1, tbody => 1, tfoot => 1,
3763             thead => 1, tr => 1,
3764             }->{$token->{tag_name}} and
3765             ($self->{insertion_mode} & IM_MASK) == IN_CELL_IM) {
3766             ## have an element in table scope
3767 11         35 my $i;
3768             my $tn;
3769             INSCOPE: {
3770 11         20 for (reverse 0..$#{$self->{open_elements}}) {
  11         27  
  11         46  
3771 42         87 my $node = $self->{open_elements}->[$_];
3772 42 100       237 if ($node->[0]->localname eq $token->{tag_name}) {
    100          
    100          
3773            
3774 8         26 $i = $_;
3775              
3776             ## Close the cell
3777            
3778 8         29 $token->{self_closing} = $self->{self_closing};
3779 8         14 unshift @{$self->{token}}, $token;
  8         26  
3780 8         18 delete $self->{self_closing};
3781             #
3782             $token = {type => END_TAG_TOKEN, tag_name => $tn,
3783             line => $token->{line},
3784 8         55 column => $token->{column}};
3785 8         32 next B;
3786             } elsif ($node->[1] == TABLE_CELL_EL) {
3787            
3788 11         66 $tn = $node->[0]->tagName;
3789             ## NOTE: There is exactly one |td| or |th| element
3790             ## in scope in the stack of open elements by definition.
3791             } elsif ($node->[1] & TABLE_SCOPING_EL) {
3792             ## ISSUE: Can this be reached?
3793            
3794 3         7 last;
3795             }
3796             }
3797              
3798            
3799             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3800 3         17 text => $token->{tag_name}, token => $token);
3801             ## Ignore the token
3802 3         10 $token = $self->_get_next_token;
3803 3         11 next B;
3804             } # INSCOPE
3805             } elsif ($token->{tag_name} eq 'table' and
3806             ($self->{insertion_mode} & IM_MASK) == IN_CAPTION_IM) {
3807 3         17 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', text => 'caption',
3808             token => $token);
3809              
3810             ## As if
3811             ## have a table element in table scope
3812 3         12 my $i;
3813 3         11 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  3         16  
3814 6         16 my $node = $self->{open_elements}->[$_];
3815 6 100       63 if ($node->[1] == CAPTION_EL) {
    50          
3816            
3817 3         5 $i = $_;
3818 3         13 last INSCOPE;
3819             } elsif ($node->[1] & TABLE_SCOPING_EL) {
3820            
3821 0         0 last INSCOPE;
3822             }
3823             } # INSCOPE
3824 3 50       17 unless (defined $i) {
3825            
3826             ## TODO: Wrong error type?
3827 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3828             text => 'caption', token => $token);
3829             ## Ignore the token
3830 0         0 $token = $self->_get_next_token;
3831 0         0 next B;
3832             }
3833            
3834             ## generate implied end tags
3835 3         14 while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) {
3836            
3837 1         3 pop @{$self->{open_elements}};
  1         6  
3838             }
3839              
3840 3 100       26 unless ($self->{open_elements}->[-1]->[1] == CAPTION_EL) {
3841            
3842             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
3843 2         30 text => $self->{open_elements}->[-1]->[0]
3844             ->tagName,
3845             token => $token);
3846             } else {
3847            
3848             }
3849              
3850 3         10 splice @{$self->{open_elements}}, $i;
  3         14  
3851              
3852 3         42 $clear_up_to_marker->($active_formatting_elements);
3853              
3854 3         9 $self->{insertion_mode} = IN_TABLE_IM;
3855              
3856             ## reprocess
3857 3         10 next B;
3858             } elsif ({
3859             body => 1, col => 1, colgroup => 1, html => 1,
3860             }->{$token->{tag_name}}) {
3861 57 100       311 if ($self->{insertion_mode} & BODY_TABLE_IMS) {
3862            
3863             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3864 4         14 text => $token->{tag_name}, token => $token);
3865             ## Ignore the token
3866 4         12 $token = $self->_get_next_token;
3867 4         14 next B;
3868             } else {
3869            
3870             #
3871             }
3872             } elsif ({
3873             tbody => 1, tfoot => 1,
3874             thead => 1, tr => 1,
3875             }->{$token->{tag_name}} and
3876             ($self->{insertion_mode} & IM_MASK) == IN_CAPTION_IM) {
3877            
3878             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
3879 0         0 text => $token->{tag_name}, token => $token);
3880             ## Ignore the token
3881 0         0 $token = $self->_get_next_token;
3882 0         0 next B;
3883             } else {
3884            
3885             #
3886             }
3887             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
3888 586         882 for my $entry (@{$self->{open_elements}}) {
  586         1466  
3889 1400 100       3094 unless ($entry->[1] & ALL_END_TAG_OPTIONAL_EL) {
3890            
3891 173         678 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in body:#eof', token => $token);
3892 173         336 last;
3893             }
3894             }
3895              
3896             ## Stop parsing.
3897 586         2026 last B;
3898             } else {
3899 0         0 die "$0: $token->{type}: Unknown token type";
3900             }
3901              
3902 1412         4025 $insert = $insert_to_current;
3903             #
3904             } elsif ($self->{insertion_mode} & TABLE_IMS) {
3905 397 100       1169 if ($token->{type} == START_TAG_TOKEN) {
    100          
    50          
3906 229 100       2265 if ({
    100          
    100          
    100          
    100          
    100          
    100          
3907             tr => (($self->{insertion_mode} & IM_MASK) != IN_ROW_IM),
3908             th => 1, td => 1,
3909             }->{$token->{tag_name}}) {
3910 102 100       379 if (($self->{insertion_mode} & IM_MASK) == IN_TABLE_IM) {
3911             ## Clear back to table context
3912 58         231 while (not ($self->{open_elements}->[-1]->[1]
3913             & TABLE_SCOPING_EL)) {
3914            
3915 5         24 pop @{$self->{open_elements}};
  5         19  
3916             }
3917            
3918            
3919             {
3920 58         101 my $el;
  58         90  
3921            
3922 58         468 $el = $self->{document}->createElementNS((HTML_NS), 'tbody');
3923            
3924             $self->_data($el, manakai_source_line => $token->{line})
3925 58 50       697 if defined $token->{line};
3926             $self->_data($el, manakai_source_column => $token->{column})
3927 58 50       297 if defined $token->{column};
3928 58         204 $self->_data($el, implied => __LINE__);
3929            
3930 58         375 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3931 58   50     204 push @{$self->{open_elements}}, [$el, $el_category->{'tbody'} || 0];
  58         927  
3932             }
3933            
3934 58         137 $self->{insertion_mode} = IN_TABLE_BODY_IM;
3935             ## reprocess in the "in table body" insertion mode...
3936             }
3937            
3938 102 100       289 if (($self->{insertion_mode} & IM_MASK) == IN_TABLE_BODY_IM) {
3939 70 100       231 unless ($token->{tag_name} eq 'tr') {
3940            
3941 20         66 $self->{parse_error}->(level => $self->{level}->{must}, type => 'missing start tag:tr', token => $token);
3942             }
3943            
3944             ## Clear back to table body context
3945 70         285 while (not ($self->{open_elements}->[-1]->[1]
3946             & TABLE_ROWS_SCOPING_EL)) {
3947            
3948             ## ISSUE: Can this case be reached?
3949 0         0 pop @{$self->{open_elements}};
  0         0  
3950             }
3951            
3952 70         136 $self->{insertion_mode} = IN_ROW_IM;
3953 70 100       202 if ($token->{tag_name} eq 'tr') {
3954            
3955            
3956             {
3957 50         92 my $el;
  50         87  
3958            
3959 50         367 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
3960            
3961 50         103 for my $attr_name (keys %{ $token->{attributes}}) {
  50         241  
3962 0         0 my $attr_t = $token->{attributes}->{$attr_name};
3963 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
3964 0         0 $attr->setValue($attr_t->{value});
3965 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
3966 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
3967 0         0 $el->setAttributeNodeNS($attr);
3968             }
3969            
3970             $self->_data($el, manakai_source_line => $token->{line})
3971 50 50       285 if defined $token->{line};
3972             $self->_data($el, manakai_source_column => $token->{column})
3973 50 50       234 if defined $token->{column};
3974            
3975 50         285 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3976 50   50     150 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  50         767  
3977             }
3978            
3979 50 50       198 $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
3980            
3981 50         180 $token = $self->_get_next_token;
3982 50         158 next B;
3983             } else {
3984            
3985            
3986             {
3987 20         37 my $el;
  20         40  
3988            
3989             $el = $self->{document}->createElementNS
3990 20         136 ((HTML_NS), 'tr');
3991            
3992             $self->_data($el, manakai_source_line => $token->{line})
3993 20 50       104 if defined $token->{line};
3994             $self->_data($el, manakai_source_column => $token->{column})
3995 20 50       116 if defined $token->{column};
3996 20         73 $self->_data($el, implied => __LINE__);
3997            
3998 20         114 $self->{open_elements}->[-1]->[0]->appendChild ($el);
3999 20   50     59 push @{$self->{open_elements}}, [$el, $el_category->{'tr'} || 0];
  20         295  
4000             }
4001            
4002             ## reprocess in the "in row" insertion mode
4003             }
4004             } else {
4005            
4006             }
4007              
4008             ## Clear back to table row context
4009 52         219 while (not ($self->{open_elements}->[-1]->[1]
4010             & TABLE_ROW_SCOPING_EL)) {
4011            
4012 2         16 pop @{$self->{open_elements}};
  2         8  
4013             }
4014            
4015            
4016             {
4017 52         103 my $el;
  52         135  
4018            
4019 52         421 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
4020            
4021 52         122 for my $attr_name (keys %{ $token->{attributes}}) {
  52         247  
4022 3         9 my $attr_t = $token->{attributes}->{$attr_name};
4023 3         44 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
4024 3         23 $attr->setValue($attr_t->{value});
4025 3         14 $self->_data($attr, manakai_source_line => $attr_t->{line});
4026 3         15 $self->_data($attr, manakai_source_column => $attr_t->{column});
4027 3         36 $el->setAttributeNodeNS ($attr);
4028             }
4029            
4030             $self->_data($el, manakai_source_line => $token->{line})
4031 52 50       304 if defined $token->{line};
4032             $self->_data($el, manakai_source_column => $token->{column})
4033 52 50       237 if defined $token->{column};
4034            
4035 52         340 $self->{open_elements}->[-1]->[0]->appendChild ($el);
4036 52   50     166 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  52         822  
4037             }
4038            
4039 52 50       200 $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
4040 52         149 $self->{insertion_mode} = IN_CELL_IM;
4041              
4042 52         175 push @$active_formatting_elements, ['#marker', '', undef];
4043            
4044            
4045 52         210 $token = $self->_get_next_token;
4046 52         200 next B;
4047             } elsif ({
4048             caption => 1, col => 1, colgroup => 1,
4049             tbody => 1, tfoot => 1, thead => 1,
4050             tr => 1, # $self->{insertion_mode} == IN_ROW_IM
4051             }->{$token->{tag_name}}) {
4052 30 100       190 if (($self->{insertion_mode} & IM_MASK) == IN_ROW_IM) {
4053             ## As if
4054             ## have an element in table scope
4055 2         4 my $i;
4056 2         4 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  2         7  
4057 2         5 my $node = $self->{open_elements}->[$_];
4058 2 50       17 if ($node->[1] == TABLE_ROW_EL) {
    0          
4059            
4060 2         5 $i = $_;
4061 2         5 last INSCOPE;
4062             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4063            
4064 0         0 last INSCOPE;
4065             }
4066             } # INSCOPE
4067 2 50       7 unless (defined $i) {
4068            
4069             ## TODO: This type is wrong.
4070             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmacthed end tag',
4071 0         0 text => $token->{tag_name}, token => $token);
4072             ## Ignore the token
4073            
4074 0         0 $token = $self->_get_next_token;
4075 0         0 next B;
4076             }
4077            
4078             ## Clear back to table row context
4079 2         8 while (not ($self->{open_elements}->[-1]->[1]
4080             & TABLE_ROW_SCOPING_EL)) {
4081            
4082             ## ISSUE: Can this case be reached?
4083 0         0 pop @{$self->{open_elements}};
  0         0  
4084             }
4085            
4086 2         19 pop @{$self->{open_elements}}; # tr
  2         6  
4087 2         9 $self->{insertion_mode} = IN_TABLE_BODY_IM;
4088 2 100       32 if ($token->{tag_name} eq 'tr') {
4089            
4090             ## reprocess
4091            
4092 1         6 next B;
4093             } else {
4094            
4095             ## reprocess in the "in table body" insertion mode...
4096             }
4097             }
4098              
4099 29 100       150 if (($self->{insertion_mode} & IM_MASK) == IN_TABLE_BODY_IM) {
4100             ## have an element in table scope
4101 1         3 my $i;
4102 1         3 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  1         3  
4103 1         3 my $node = $self->{open_elements}->[$_];
4104 1 50       4 if ($node->[1] == TABLE_ROW_GROUP_EL) {
    0          
4105            
4106 1         2 $i = $_;
4107 1         3 last INSCOPE;
4108             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4109            
4110 0         0 last INSCOPE;
4111             }
4112             } # INSCOPE
4113 1 50       4 unless (defined $i) {
4114            
4115             ## TODO: This erorr type is wrong.
4116             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4117 0         0 text => $token->{tag_name}, token => $token);
4118             ## Ignore the token
4119            
4120 0         0 $token = $self->_get_next_token;
4121 0         0 next B;
4122             }
4123              
4124             ## Clear back to table body context
4125 1         5 while (not ($self->{open_elements}->[-1]->[1]
4126             & TABLE_ROWS_SCOPING_EL)) {
4127            
4128             ## ISSUE: Can this state be reached?
4129 0         0 pop @{$self->{open_elements}};
  0         0  
4130             }
4131            
4132             ## As if <{current node}>
4133             ## have an element in table scope
4134             ## true by definition
4135            
4136             ## Clear back to table body context
4137             ## nop by definition
4138            
4139 1         3 pop @{$self->{open_elements}};
  1         2  
4140 1         3 $self->{insertion_mode} = IN_TABLE_IM;
4141             ## reprocess in "in table" insertion mode...
4142             } else {
4143            
4144             }
4145              
4146 29 100       264 if ($token->{tag_name} eq 'col') {
    50          
4147             ## Clear back to table context
4148 3         24 while (not ($self->{open_elements}->[-1]->[1]
4149             & TABLE_SCOPING_EL)) {
4150            
4151             ## ISSUE: Can this state be reached?
4152 0         0 pop @{$self->{open_elements}};
  0         0  
4153             }
4154            
4155            
4156             {
4157 3         8 my $el;
  3         6  
4158            
4159 3         38 $el = $self->{document}->createElementNS((HTML_NS), 'colgroup');
4160            
4161             $self->_data($el, manakai_source_line => $token->{line})
4162 3 50       31 if defined $token->{line};
4163             $self->_data($el, manakai_source_column => $token->{column})
4164 3 50       23 if defined $token->{column};
4165 3         16 $self->_data($el, implied => __LINE__);
4166            
4167 3         23 $self->{open_elements}->[-1]->[0]->appendChild ($el);
4168 3   50     14 push @{$self->{open_elements}}, [$el, $el_category->{'colgroup'} || 0];
  3         64  
4169             }
4170            
4171 3         10 $self->{insertion_mode} = IN_COLUMN_GROUP_IM;
4172             ## reprocess
4173 3 50       19 $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
4174            
4175 3         15 next B;
4176             } elsif ({
4177             caption => 1,
4178             colgroup => 1,
4179             tbody => 1, tfoot => 1, thead => 1,
4180             }->{$token->{tag_name}}) {
4181             ## Clear back to table context
4182 26         127 while (not ($self->{open_elements}->[-1]->[1]
4183             & TABLE_SCOPING_EL)) {
4184            
4185             ## ISSUE: Can this state be reached?
4186 0         0 pop @{$self->{open_elements}};
  0         0  
4187             }
4188            
4189             push @$active_formatting_elements, ['#marker', '', undef]
4190 26 100       120 if $token->{tag_name} eq 'caption';
4191            
4192            
4193             {
4194 26         52 my $el;
  26         51  
4195            
4196 26         270 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
4197            
4198 26         85 for my $attr_name (keys %{ $token->{attributes}}) {
  26         131  
4199 0         0 my $attr_t = $token->{attributes}->{$attr_name};
4200 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
4201 0         0 $attr->setValue($attr_t->{value});
4202 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
4203 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
4204 0         0 $el->setAttributeNodeNS ($attr);
4205             }
4206            
4207             $self->_data($el, manakai_source_line => $token->{line})
4208 26 50       170 if defined $token->{line};
4209             $self->_data($el, manakai_source_column => $token->{column})
4210 26 50       152 if defined $token->{column};
4211            
4212 26         214 $self->{open_elements}->[-1]->[0]->appendChild ($el);
4213 26   50     106 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  26         486  
4214             }
4215            
4216 26 50       142 $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
4217             $self->{insertion_mode} = {
4218             caption => IN_CAPTION_IM,
4219             colgroup => IN_COLUMN_GROUP_IM,
4220             tbody => IN_TABLE_BODY_IM,
4221             tfoot => IN_TABLE_BODY_IM,
4222             thead => IN_TABLE_BODY_IM,
4223 26         133 }->{$token->{tag_name}};
4224 26         123 $token = $self->_get_next_token;
4225            
4226 26         106 next B;
4227             } else {
4228 0         0 die "$0: in table: <>: $token->{tag_name}";
4229             }
4230             } elsif ($token->{tag_name} eq 'table') {
4231             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
4232 3         41 text => $self->{open_elements}->[-1]->[0]
4233             ->tagName,
4234             token => $token);
4235              
4236             ## As if
4237             ## have a table element in table scope
4238 3         17 my $i;
4239 3         15 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  3         19  
4240 6         13 my $node = $self->{open_elements}->[$_];
4241 6 100       39 if ($node->[1] == TABLE_EL) {
    50          
4242            
4243 3         8 $i = $_;
4244 3         10 last INSCOPE;
4245             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4246            
4247 0         0 last INSCOPE;
4248             }
4249             } # INSCOPE
4250 3 50       10 unless (defined $i) {
4251            
4252             ## TODO: The following is wrong, maybe.
4253 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', text => 'table',
4254             token => $token);
4255             ## Ignore tokens
4256            
4257 0         0 $token = $self->_get_next_token;
4258 0         0 next B;
4259             }
4260            
4261             ## TODO: Followings are removed from the latest spec.
4262             ## generate implied end tags
4263 3         13 while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) {
4264            
4265 0         0 pop @{$self->{open_elements}};
  0         0  
4266             }
4267              
4268 3 100       11 unless ($self->{open_elements}->[-1]->[1] == TABLE_EL) {
4269            
4270             ## NOTE: |
|
4271             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
4272 1         10 text => $self->{open_elements}->[-1]->[0]
4273             ->tagName,
4274             token => $token);
4275             } else {
4276            
4277             }
4278              
4279 3         8 splice @{$self->{open_elements}}, $i;
  3         10  
4280 3         29 pop @{$open_tables};
  3         8  
4281              
4282 3         13 $self->_reset_insertion_mode;
4283              
4284             ## reprocess
4285            
4286 3         12 next B;
4287             } elsif ($token->{tag_name} eq 'style') {
4288            
4289             ## NOTE: This is a "as if in head" code clone.
4290 3         14 $parse_rcdata->($self, $insert, $open_tables, 0); # RAWTEXT
4291 3 50       16 $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
4292 3         13 next B;
4293             } elsif ($token->{tag_name} eq 'script') {
4294            
4295             ## NOTE: This is a "as if in head" code clone.
4296 2         11 $script_start_tag->($self, $insert, $open_tables);
4297 2 50       13 $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
4298 2         11 next B;
4299             } elsif ($token->{tag_name} eq 'input') {
4300 8 100       24 if ($token->{attributes}->{type}) {
4301 7         29 my $type = $token->{attributes}->{type}->{value};
4302 7         22 $type =~ tr/A-Z/a-z/; ## ASCII case-insensitive.
4303 7 100       22 if ($type eq 'hidden') {
4304            
4305             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in table',
4306 6         29 text => $token->{tag_name}, token => $token);
4307              
4308            
4309             {
4310 6         12 my $el;
  6         14  
4311            
4312 6         67 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
4313            
4314 6         29 for my $attr_name (keys %{ $token->{attributes}}) {
  6         31  
4315 6         16 my $attr_t = $token->{attributes}->{$attr_name};
4316 6         56 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
4317 6         29 $attr->setValue($attr_t->{value});
4318 6         28 $self->_data($attr, manakai_source_line => $attr_t->{line});
4319 6         33 $self->_data($attr, manakai_source_column => $attr_t->{column});
4320 6         86 $el->setAttributeNodeNS ($attr);
4321             }
4322            
4323             $self->_data($el, manakai_source_line => $token->{line})
4324 6 50       38 if defined $token->{line};
4325             $self->_data($el, manakai_source_column => $token->{column})
4326 6 50       46 if defined $token->{column};
4327            
4328 6         59 $self->{open_elements}->[-1]->[0]->appendChild ($el);
4329 6   50     22 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  6         112  
4330             }
4331            
4332 6 50       32 $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
4333              
4334             ## TODO: form element pointer
4335              
4336 6         12 pop @{$self->{open_elements}};
  6         11  
4337              
4338 6         18 $token = $self->_get_next_token;
4339 6         21 delete $self->{self_closing};
4340 6         27 next B;
4341             } else {
4342            
4343             #
4344             }
4345             } else {
4346            
4347             #
4348             }
4349             } elsif ($token->{tag_name} eq 'form') {
4350 5         25 $self->{parse_error}->(level => $self->{level}->{must}, type => 'form in table', token => $token); # XXX documentation
4351            
4352 5 100       24 if ($self->{form_element}) {
4353             ## Ignore the token.
4354 2         16 $token = $self->_get_next_token;
4355            
4356 2         8 next B;
4357             } else {
4358            
4359             {
4360 3         9 my $el;
  3         11  
4361            
4362 3         40 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
4363            
4364 3         12 for my $attr_name (keys %{ $token->{attributes}}) {
  3         16  
4365 0         0 my $attr_t = $token->{attributes}->{$attr_name};
4366 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
4367 0         0 $attr->setValue($attr_t->{value});
4368 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
4369 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
4370 0         0 $el->setAttributeNodeNS($attr);
4371             }
4372            
4373             $self->_data($el, manakai_source_line => $token->{line})
4374 3 50       19 if defined $token->{line};
4375             $self->_data($el, manakai_source_column => $token->{column})
4376 3 50       19 if defined $token->{column};
4377            
4378 3         25 $self->{open_elements}->[-1]->[0]->appendChild ($el);
4379 3   50     12 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  3         68  
4380             }
4381            
4382 3         14 $self->{form_element} = $self->{open_elements}->[-1]->[0];
4383            
4384 3         5 pop @{$self->{open_elements}};
  3         8  
4385            
4386 3         16 $token = $self->_get_next_token;
4387            
4388 3         12 next B;
4389             }
4390             } else {
4391            
4392             #
4393             }
4394              
4395             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in table', text => $token->{tag_name},
4396 78         463 token => $token);
4397              
4398 78         184 $insert = $insert_to_foster;
4399             #
4400             } elsif ($token->{type} == END_TAG_TOKEN) {
4401 126 100 100     1172 if ($token->{tag_name} eq 'tr' and
    100 100        
    100          
    100          
4402             ($self->{insertion_mode} & IM_MASK) == IN_ROW_IM) {
4403             ## have an element in table scope
4404 14         36 my $i;
4405 14         36 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  14         67  
4406 14         43 my $node = $self->{open_elements}->[$_];
4407 14 50       42 if ($node->[1] == TABLE_ROW_EL) {
    0          
4408            
4409 14         33 $i = $_;
4410 14         28 last INSCOPE;
4411             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4412            
4413 0         0 last INSCOPE;
4414             }
4415             } # INSCOPE
4416 14 50       73 unless (defined $i) {
4417            
4418             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4419 0         0 text => $token->{tag_name}, token => $token);
4420             ## Ignore the token
4421            
4422 0         0 $token = $self->_get_next_token;
4423 0         0 next B;
4424             } else {
4425            
4426             }
4427              
4428             ## Clear back to table row context
4429 14         63 while (not ($self->{open_elements}->[-1]->[1]
4430             & TABLE_ROW_SCOPING_EL)) {
4431            
4432             ## ISSUE: Can this state be reached?
4433 0         0 pop @{$self->{open_elements}};
  0         0  
4434             }
4435              
4436 14         24 pop @{$self->{open_elements}}; # tr
  14         33  
4437 14         53 $self->{insertion_mode} = IN_TABLE_BODY_IM;
4438 14         211 $token = $self->_get_next_token;
4439            
4440 14         39 next B;
4441             } elsif ($token->{tag_name} eq 'table') {
4442 56 100       280 if (($self->{insertion_mode} & IM_MASK) == IN_ROW_IM) {
4443             ## As if
4444             ## have an element in table scope
4445 13         24 my $i;
4446 13         32 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  13         52  
4447 14         35 my $node = $self->{open_elements}->[$_];
4448 14 100       454 if ($node->[1] == TABLE_ROW_EL) {
    50          
4449            
4450 13         25 $i = $_;
4451 13         63 last INSCOPE;
4452             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4453            
4454 0         0 last INSCOPE;
4455             }
4456             } # INSCOPE
4457 13 50       55 unless (defined $i) {
4458            
4459             ## TODO: The following is wrong.
4460             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4461 0         0 text => $token->{type}, token => $token);
4462             ## Ignore the token
4463            
4464 0         0 $token = $self->_get_next_token;
4465 0         0 next B;
4466             }
4467            
4468             ## Clear back to table row context
4469 13         51 while (not ($self->{open_elements}->[-1]->[1]
4470             & TABLE_ROW_SCOPING_EL)) {
4471            
4472             ## ISSUE: Can this state be reached?
4473 1         3 pop @{$self->{open_elements}};
  1         4  
4474             }
4475            
4476 13         25 pop @{$self->{open_elements}}; # tr
  13         30  
4477 13         49 $self->{insertion_mode} = IN_TABLE_BODY_IM;
4478             ## reprocess in the "in table body" insertion mode...
4479             }
4480              
4481 56 100       350 if (($self->{insertion_mode} & IM_MASK) == IN_TABLE_BODY_IM) {
4482             ## have an element in table scope
4483 21         37 my $i;
4484 21         61 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  21         68  
4485 22         55 my $node = $self->{open_elements}->[$_];
4486 22 100       89 if ($node->[1] == TABLE_ROW_GROUP_EL) {
    50          
4487            
4488 21         38 $i = $_;
4489 21         53 last INSCOPE;
4490             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4491            
4492 0         0 last INSCOPE;
4493             }
4494             } # INSCOPE
4495 21 50       72 unless (defined $i) {
4496            
4497             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4498 0         0 text => $token->{tag_name}, token => $token);
4499             ## Ignore the token
4500            
4501 0         0 $token = $self->_get_next_token;
4502 0         0 next B;
4503             }
4504            
4505             ## Clear back to table body context
4506 21         81 while (not ($self->{open_elements}->[-1]->[1]
4507             & TABLE_ROWS_SCOPING_EL)) {
4508            
4509 1         6 pop @{$self->{open_elements}};
  1         4  
4510             }
4511            
4512             ## As if <{current node}>
4513             ## have an element in table scope
4514             ## true by definition
4515            
4516             ## Clear back to table body context
4517             ## nop by definition
4518            
4519 21         43 pop @{$self->{open_elements}};
  21         44  
4520 21         71 $self->{insertion_mode} = IN_TABLE_IM;
4521             ## reprocess in the "in table" insertion mode...
4522             }
4523              
4524             ## NOTE:
in the "in table" insertion mode.
4525             ## When you edit the code fragment below, please ensure that
4526             ## the code for in the "in table" insertion mode
4527             ## is synced with it.
4528              
4529             ## have a table element in table scope
4530 56         355 my $i;
4531 56         131 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  56         216  
4532 57         127 my $node = $self->{open_elements}->[$_];
4533 57 100       173 if ($node->[1] == TABLE_EL) {
    50          
4534            
4535 56         112 $i = $_;
4536 56         125 last INSCOPE;
4537             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4538            
4539 0         0 last INSCOPE;
4540             }
4541             } # INSCOPE
4542 56 50       159 unless (defined $i) {
4543            
4544             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4545 0         0 text => $token->{tag_name}, token => $token);
4546             ## Ignore the token
4547            
4548 0         0 $token = $self->_get_next_token;
4549 0         0 next B;
4550             }
4551            
4552 56         128 splice @{$self->{open_elements}}, $i;
  56         152  
4553 56         139 pop @{$open_tables};
  56         137  
4554            
4555 56         242 $self->_reset_insertion_mode;
4556            
4557 56         227 $token = $self->_get_next_token;
4558 56         166 next B;
4559             } elsif ({
4560             tbody => 1, tfoot => 1, thead => 1,
4561             }->{$token->{tag_name}} and
4562             $self->{insertion_mode} & ROW_IMS) {
4563 7 100       36 if (($self->{insertion_mode} & IM_MASK) == IN_ROW_IM) {
4564             ## have an element in table scope
4565 3         8 my $i;
4566 3         9 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  3         13  
4567 6         16 my $node = $self->{open_elements}->[$_];
4568 6 100       38 if ($node->[0]->tagName eq $token->{tag_name}) {
    50          
4569            
4570 3         8 $i = $_;
4571 3         8 last INSCOPE;
4572             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4573            
4574 0         0 last INSCOPE;
4575             }
4576             } # INSCOPE
4577 3 50       22 unless (defined $i) {
4578            
4579             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4580 0         0 text => $token->{tag_name}, token => $token);
4581             ## Ignore the token
4582            
4583 0         0 $token = $self->_get_next_token;
4584 0         0 next B;
4585             }
4586            
4587             ## As if
4588             ## have an element in table scope
4589 11     11   196 no warnings; my $i; use warnings;
  11     11   30  
  11         726  
  11         75  
  11         25  
  11         131299  
  3         7  
4590 3         10 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  3         10  
4591 3         10 my $node = $self->{open_elements}->[$_];
4592 3 50       10 if ($node->[1] == TABLE_ROW_EL) {
    0          
4593            
4594 3         7 $i = $_;
4595 3         8 last INSCOPE;
4596             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4597            
4598 0         0 last INSCOPE;
4599             }
4600             } # INSCOPE
4601 3 50       11 unless (defined $i) {
4602            
4603 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4604             text => 'tr', token => $token);
4605             ## Ignore the token
4606            
4607 0         0 $token = $self->_get_next_token;
4608 0         0 next B;
4609             }
4610            
4611             ## Clear back to table row context
4612 3         11 while (not ($self->{open_elements}->[-1]->[1]
4613             & TABLE_ROW_SCOPING_EL)) {
4614            
4615             ## ISSUE: Can this case be reached?
4616 0         0 pop @{$self->{open_elements}};
  0         0  
4617             }
4618            
4619 3         7 pop @{$self->{open_elements}}; # tr
  3         9  
4620 3         10 $self->{insertion_mode} = IN_TABLE_BODY_IM;
4621             ## reprocess in the "in table body" insertion mode...
4622             }
4623              
4624             ## have an element in table scope
4625 7         58 my $i;
4626 7         21 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  7         31  
4627 7         23 my $node = $self->{open_elements}->[$_];
4628 7 50       53 if ($node->[0]->tagName eq $token->{tag_name}) {
    0          
4629            
4630 7         17 $i = $_;
4631 7         18 last INSCOPE;
4632             } elsif ($node->[1] & TABLE_SCOPING_EL) {
4633            
4634 0         0 last INSCOPE;
4635             }
4636             } # INSCOPE
4637 7 50       28 unless (defined $i) {
4638            
4639             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4640 0         0 text => $token->{tag_name}, token => $token);
4641             ## Ignore the token
4642            
4643 0         0 $token = $self->_get_next_token;
4644 0         0 next B;
4645             }
4646              
4647             ## Clear back to table body context
4648 7         39 while (not ($self->{open_elements}->[-1]->[1]
4649             & TABLE_ROWS_SCOPING_EL)) {
4650            
4651             ## ISSUE: Can this case be reached?
4652 0         0 pop @{$self->{open_elements}};
  0         0  
4653             }
4654              
4655 7         16 pop @{$self->{open_elements}};
  7         21  
4656 7         26 $self->{insertion_mode} = IN_TABLE_IM;
4657            
4658 7         104 $token = $self->_get_next_token;
4659 7         28 next B;
4660             } elsif ({
4661             body => 1, caption => 1, col => 1, colgroup => 1,
4662             html => 1, td => 1, th => 1,
4663             tr => 1, # $self->{insertion_mode} == IN_ROW_IM
4664             tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM
4665             }->{$token->{tag_name}}) {
4666            
4667             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4668 19         67 text => $token->{tag_name}, token => $token);
4669             ## Ignore the token
4670            
4671 19         54 $token = $self->_get_next_token;
4672 19         68 next B;
4673             } else {
4674            
4675             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in table:/',
4676 30         140 text => $token->{tag_name}, token => $token);
4677              
4678 30         71 $insert = $insert_to_foster;
4679             #
4680             }
4681             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
4682 42 50 33     178 unless ($self->{open_elements}->[-1]->[1] == HTML_EL and
4683 0         0 @{$self->{open_elements}} == 1) { # redundant, maybe
4684 42         140 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in body:#eof', token => $token);
4685            
4686             #
4687             } else {
4688            
4689             #
4690             }
4691              
4692             ## Stop parsing
4693 42         179 last B;
4694             } else {
4695 0         0 die "$0: $token->{type}: Unknown token type";
4696             }
4697             } elsif (($self->{insertion_mode} & IM_MASK) == IN_COLUMN_GROUP_IM) {
4698 8 50       65 if ($token->{type} == CHARACTER_TOKEN) {
    100          
    100          
    50          
4699 0 0       0 if ($token->{data} =~ s/^([\x09\x0A\x0C\x20]+)//) {
4700 0         0 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $1, $token);
4701 0 0       0 unless (length $token->{data}) {
4702            
4703 0         0 $token = $self->_get_next_token;
4704 0         0 next B;
4705             }
4706             }
4707            
4708            
4709             #
4710             } elsif ($token->{type} == START_TAG_TOKEN) {
4711 6 100       31 if ($token->{tag_name} eq 'col') {
4712            
4713            
4714             {
4715 3         9 my $el;
  3         10  
4716            
4717 3         38 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
4718            
4719 3         12 for my $attr_name (keys %{ $token->{attributes}}) {
  3         18  
4720 1         3 my $attr_t = $token->{attributes}->{$attr_name};
4721 1         8 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
4722 1         6 $attr->setValue($attr_t->{value});
4723 1         4 $self->_data($attr, manakai_source_line => $attr_t->{line});
4724 1         4 $self->_data($attr, manakai_source_column => $attr_t->{column});
4725 1         7 $el->setAttributeNodeNS ($attr);
4726             }
4727            
4728             $self->_data($el, manakai_source_line => $token->{line})
4729 3 50       28 if defined $token->{line};
4730             $self->_data($el, manakai_source_column => $token->{column})
4731 3 50       30 if defined $token->{column};
4732            
4733 3         24 $self->{open_elements}->[-1]->[0]->appendChild ($el);
4734 3   50     15 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  3         54  
4735             }
4736            
4737 3         8 pop @{$self->{open_elements}};
  3         11  
4738 3         10 delete $self->{self_closing};
4739 3         40 $token = $self->_get_next_token;
4740 3         9 next B;
4741             } else {
4742            
4743             #
4744             }
4745             } elsif ($token->{type} == END_TAG_TOKEN) {
4746 1 50       9 if ($token->{tag_name} eq 'colgroup') {
    50          
4747 0 0       0 if ($self->{open_elements}->[-1]->[1] == HTML_EL) {
4748            
4749 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4750             text => 'colgroup', token => $token);
4751             ## Ignore the token
4752 0         0 $token = $self->_get_next_token;
4753 0         0 next B;
4754             } else {
4755            
4756 0         0 pop @{$self->{open_elements}}; # colgroup
  0         0  
4757 0         0 $self->{insertion_mode} = IN_TABLE_IM;
4758 0         0 $token = $self->_get_next_token;
4759 0         0 next B;
4760             }
4761             } elsif ($token->{tag_name} eq 'col') {
4762            
4763 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4764             text => 'col', token => $token);
4765             ## Ignore the token
4766 0         0 $token = $self->_get_next_token;
4767 0         0 next B;
4768             } else {
4769            
4770             #
4771             }
4772             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
4773 1 50 33     11 if ($self->{open_elements}->[-1]->[1] == HTML_EL and
4774 0         0 @{$self->{open_elements}} == 1) { # redundant, maybe
4775            
4776             ## Stop parsing.
4777 0         0 last B;
4778             } else {
4779             ## NOTE: As if .
4780            
4781 1         2 pop @{$self->{open_elements}}; # colgroup
  1         4  
4782 1         4 $self->{insertion_mode} = IN_TABLE_IM;
4783             ## Reprocess.
4784 1         17 next B;
4785             }
4786             } else {
4787 0         0 die "$0: $token->{type}: Unknown token type";
4788             }
4789              
4790             ## As if
4791 4 50       19 if ($self->{open_elements}->[-1]->[1] == HTML_EL) {
4792            
4793             ## TODO: Wrong error type?
4794 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
4795             text => 'colgroup', token => $token);
4796             ## Ignore the token
4797            
4798 0         0 $token = $self->_get_next_token;
4799 0         0 next B;
4800             } else {
4801            
4802 4         8 pop @{$self->{open_elements}}; # colgroup
  4         14  
4803 4         21 $self->{insertion_mode} = IN_TABLE_IM;
4804            
4805             ## reprocess
4806 4         64 next B;
4807             }
4808             } elsif ($self->{insertion_mode} & SELECT_IMS) {
4809 131 100       476 if ($token->{type} == CHARACTER_TOKEN) {
    100          
    100          
    50          
4810            
4811 17         43 my $data = $token->{data};
4812 17         79 while ($data =~ s/\x00//) {
4813 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'NULL', token => $token);
4814             }
4815 17 50       109 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $data, $token)
4816             if $data ne '';
4817 17         88 $token = $self->_get_next_token;
4818 17         48 next B;
4819             } elsif ($token->{type} == START_TAG_TOKEN) {
4820 58 100 100     622 if ($token->{tag_name} eq 'option') {
    100          
    100          
    100          
    100          
    100          
4821 15 100       48 if ($self->{open_elements}->[-1]->[1] == OPTION_EL) {
4822            
4823             ## As if
4824 1         4 pop @{$self->{open_elements}};
  1         3  
4825             } else {
4826            
4827             }
4828              
4829            
4830             {
4831 15         29 my $el;
  15         42  
4832            
4833 15         146 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
4834            
4835 15         51 for my $attr_name (keys %{ $token->{attributes}}) {
  15         68  
4836 0         0 my $attr_t = $token->{attributes}->{$attr_name};
4837 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
4838 0         0 $attr->setValue($attr_t->{value});
4839 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
4840 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
4841 0         0 $el->setAttributeNodeNS ($attr);
4842             }
4843            
4844             $self->_data($el, manakai_source_line => $token->{line})
4845 15 50       89 if defined $token->{line};
4846             $self->_data($el, manakai_source_column => $token->{column})
4847 15 50       68 if defined $token->{column};
4848            
4849 15         107 $self->{open_elements}->[-1]->[0]->appendChild ($el);
4850 15   50     58 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  15         250  
4851             }
4852            
4853            
4854 15         138 $token = $self->_get_next_token;
4855 15         35 next B;
4856             } elsif ($token->{tag_name} eq 'optgroup') {
4857 5 100       16 if ($self->{open_elements}->[-1]->[1] == OPTION_EL) {
4858            
4859             ## As if
4860 2         5 pop @{$self->{open_elements}};
  2         5  
4861             } else {
4862            
4863             }
4864              
4865 5 100       16 if ($self->{open_elements}->[-1]->[1] == OPTGROUP_EL) {
4866            
4867             ## As if
4868 1         17 pop @{$self->{open_elements}};
  1         2  
4869             } else {
4870            
4871             }
4872              
4873            
4874             {
4875 5         26 my $el;
  5         18  
4876            
4877 5         57 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
4878            
4879 5         12 for my $attr_name (keys %{ $token->{attributes}}) {
  5         19  
4880 0         0 my $attr_t = $token->{attributes}->{$attr_name};
4881 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
4882 0         0 $attr->setValue($attr_t->{value});
4883 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
4884 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
4885 0         0 $el->setAttributeNodeNS ($attr);
4886             }
4887            
4888             $self->_data($el, manakai_source_line => $token->{line})
4889 5 50       27 if defined $token->{line};
4890             $self->_data($el, manakai_source_column => $token->{column})
4891 5 50       20 if defined $token->{column};
4892            
4893 5         30 $self->{open_elements}->[-1]->[0]->appendChild ($el);
4894 5   50     19 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  5         94  
4895             }
4896            
4897            
4898 5         21 $token = $self->_get_next_token;
4899 5         11 next B;
4900              
4901             } elsif ($token->{tag_name} eq 'select') {
4902             ## "In select" / "in select in table" insertion mode,
4903             ## "select" start tag.
4904            
4905              
4906 6         47 $self->{parse_error}->(level => $self->{level}->{must}, type => 'select in select', ## XXX: documentation
4907             token => $token);
4908              
4909             ## Act as if the token were .
4910             $token = {type => END_TAG_TOKEN, tag_name => 'select',
4911 6         39 line => $token->{line}, column => $token->{column}};
4912 6         21 next B;
4913              
4914             } elsif ({
4915             input => 1, textarea => 1, keygen => 1,
4916             }->{$token->{tag_name}}) {
4917             ## "In select" / "in select in table" insertion mode,
4918             ## "input", "keygen", "textarea" start tag.
4919            
4920             ## Parse error.
4921 2         12 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', text => 'select',
4922             token => $token);
4923            
4924             ## If there "have an element in select scope" where element
4925             ## is a |select| element.
4926 2         7 my $i;
4927 2         13 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  2         8  
4928 2         5 my $node = $self->{open_elements}->[$_];
4929 2 50 0     8 if ($node->[1] == SELECT_EL) {
    0          
4930            
4931 2         6 $i = $_;
4932 2         8 last INSCOPE;
4933             } elsif ($node->[1] == OPTGROUP_EL or
4934             $node->[1] == OPTION_EL) {
4935            
4936             #
4937             } else {
4938            
4939 0         0 last INSCOPE;
4940             }
4941             } # INSCOPE
4942 2 50       7 unless (defined $i) {
4943             ## Ignore the token.
4944            
4945 0         0 $token = $self->_get_next_token;
4946 0         0 next B;
4947             }
4948              
4949             ## Otherwise, act as if there were , then reprocess
4950             ## the token.
4951 2         7 $token->{self_closing} = $self->{self_closing};
4952 2         5 unshift @{$self->{token}}, $token;
  2         5  
4953 2         5 delete $self->{self_closing};
4954            
4955             $token = {type => END_TAG_TOKEN, tag_name => 'select',
4956 2         10 line => $token->{line}, column => $token->{column}};
4957 2         5 next B;
4958            
4959             } elsif (
4960             ($self->{insertion_mode} & IM_MASK) == IN_SELECT_IN_TABLE_IM and
4961             {
4962             caption => 1, table => 1, tbody => 1, tfoot => 1, thead => 1,
4963             tr => 1, td => 1, th => 1,
4964             }->{$token->{tag_name}}
4965             ) {
4966             ## "In select in table" insertion mode, table-related start
4967             ## tags.
4968              
4969             ## Parse error.
4970 10         50 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', text => 'select',
4971             token => $token);
4972              
4973             ## Act as if there were , then reprocess the token.
4974            
4975 10         29 $token->{self_closing} = $self->{self_closing};
4976 10         20 unshift @{$self->{token}}, $token;
  10         31  
4977 10         19 delete $self->{self_closing};
4978            
4979             $token = {type => END_TAG_TOKEN, tag_name => 'select',
4980 10         46 line => $token->{line}, column => $token->{column}};
4981 10         34 next B;
4982            
4983             } elsif ($token->{tag_name} eq 'script') {
4984            
4985             ## NOTE: This is an "as if in head" code clone
4986 3         14 $script_start_tag->($self, $insert, $open_tables);
4987 3         12 next B;
4988             } else {
4989            
4990             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in select',
4991 17         85 text => $token->{tag_name}, token => $token);
4992             ## Ignore the token
4993            
4994 17         56 $token = $self->_get_next_token;
4995 17         53 next B;
4996             }
4997            
4998             } elsif ($token->{type} == END_TAG_TOKEN) {
4999 41 100 100     308 if ($token->{tag_name} eq 'optgroup') {
    100          
    100          
    100          
5000 4 100 100     31 if ($self->{open_elements}->[-1]->[1] == OPTION_EL and
    100          
5001             $self->{open_elements}->[-2]->[1] == OPTGROUP_EL) {
5002            
5003             ## As if
5004 1         4 splice @{$self->{open_elements}}, -2;
  1         5  
5005             } elsif ($self->{open_elements}->[-1]->[1] == OPTGROUP_EL) {
5006            
5007 1         3 pop @{$self->{open_elements}};
  1         4  
5008             } else {
5009            
5010             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
5011 2         8 text => $token->{tag_name}, token => $token);
5012             ## Ignore the token
5013             }
5014            
5015 4         37 $token = $self->_get_next_token;
5016 4         11 next B;
5017             } elsif ($token->{tag_name} eq 'option') {
5018 1 50       6 if ($self->{open_elements}->[-1]->[1] == OPTION_EL) {
5019            
5020 1         2 pop @{$self->{open_elements}};
  1         4  
5021             } else {
5022            
5023             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
5024 0         0 text => $token->{tag_name}, token => $token);
5025             ## Ignore the token
5026             }
5027            
5028 1         6 $token = $self->_get_next_token;
5029 1         4 next B;
5030            
5031             } elsif ($token->{tag_name} eq 'select') {
5032             ## "In select" / "in select in table" insertion mode,
5033             ## "select" end tag.
5034            
5035             ## There "have an element in select scope" where the element
5036             ## is |select|.
5037 27         61 my $i;
5038 27         73 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  27         97  
5039 34         82 my $node = $self->{open_elements}->[$_];
5040 34 100 33     106 if ($node->[1] == SELECT_EL) {
    50          
5041            
5042 27         47 $i = $_;
5043 27         62 last INSCOPE;
5044             } elsif ($node->[1] == OPTION_EL or
5045             $node->[1] == OPTGROUP_EL) {
5046            
5047             #
5048             } else {
5049            
5050 0         0 last INSCOPE;
5051             }
5052             } # INSCOPE
5053 27 50       81 unless (defined $i) {
5054            
5055             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
5056 0         0 text => $token->{tag_name}, token => $token);
5057             ## Ignore the token.
5058            
5059 0         0 $token = $self->_get_next_token;
5060 0         0 next B;
5061             }
5062            
5063             ## Otherwise,
5064            
5065 27         52 splice @{$self->{open_elements}}, $i;
  27         111  
5066              
5067 27         216 $self->_reset_insertion_mode;
5068              
5069            
5070 27         132 $token = $self->_get_next_token;
5071 27         81 next B;
5072            
5073             } elsif (
5074             ($self->{insertion_mode} & IM_MASK) == IN_SELECT_IN_TABLE_IM and
5075             {
5076             caption => 1, table => 1, tbody => 1, tfoot => 1, thead => 1,
5077             tr => 1, td => 1, th => 1,
5078             }->{$token->{tag_name}}
5079             ) {
5080             ## "In select in table" insertion mode, table-related end
5081             ## tags.
5082            
5083             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
5084 3         19 text => $token->{tag_name}, token => $token);
5085              
5086              
5087             ## There "have an element in table scope" where the element
5088             ## is same tag name as |$token|.
5089 3         8 my $i;
5090 3         13 INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
  3         16  
5091 9         16 my $node = $self->{open_elements}->[$_];
5092 9 100       59 if ($node->[0]->tagName eq $token->{tag_name}) {
    50          
5093            
5094 3         6 $i = $_;
5095 3         9 last INSCOPE;
5096             } elsif ($node->[1] & TABLE_SCOPING_EL) {
5097            
5098 0         0 last INSCOPE;
5099             }
5100             } # INSCOPE
5101 3 50       36 unless (defined $i) {
5102            
5103             ## Ignore the token
5104            
5105 0         0 $token = $self->_get_next_token;
5106 0         0 next B;
5107             }
5108              
5109             ## Act as if there were , then reprocess the token.
5110 3         14 $token->{self_closing} = $self->{self_closing};
5111 3         9 unshift @{$self->{token}}, $token;
  3         13  
5112 3         7 delete $self->{self_closing};
5113            
5114             $token = {type => END_TAG_TOKEN, tag_name => 'select',
5115 3         16 line => $token->{line}, column => $token->{column}};
5116 3         13 next B;
5117            
5118             } else {
5119            
5120             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in select:/',
5121 6         33 text => $token->{tag_name}, token => $token);
5122             ## Ignore the token
5123            
5124 6         24 $token = $self->_get_next_token;
5125 6         19 next B;
5126             }
5127             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
5128 15 50 33     49 unless ($self->{open_elements}->[-1]->[1] == HTML_EL and
5129 0         0 @{$self->{open_elements}} == 1) { # redundant, maybe
5130            
5131 15         46 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in body:#eof', token => $token);
5132             } else {
5133            
5134             }
5135              
5136             ## Stop parsing.
5137 15         50 last B;
5138             } else {
5139 0         0 die "$0: $token->{type}: Unknown token type";
5140             }
5141             } elsif ($self->{insertion_mode} & BODY_AFTER_IMS) {
5142 93 100       382 if ($token->{type} == CHARACTER_TOKEN) {
    100          
    100          
    50          
5143 12 100       99 if ($token->{data} =~ s/^([\x09\x0A\x0C\x20]+)//) {
5144 7         29 my $data = $1;
5145             ## As if in body
5146 7         28 $reconstruct_active_formatting_elements
5147             ->($self, $insert_to_current, $active_formatting_elements, $open_tables);
5148            
5149 7         105 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $1, $token);
5150            
5151 7 100       50 unless (length $token->{data}) {
5152            
5153 5         25 $token = $self->_get_next_token;
5154 5         19 next B;
5155             }
5156             }
5157            
5158 7 100       27 if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) {
5159            
5160 4         15 $self->{parse_error}->(level => $self->{level}->{must}, type => 'after html:#text', token => $token);
5161             #
5162             } else {
5163            
5164             ## "after body" insertion mode
5165 3         13 $self->{parse_error}->(level => $self->{level}->{must}, type => 'after body:#text', token => $token);
5166             #
5167             }
5168              
5169 7         18 $self->{insertion_mode} = IN_BODY_IM;
5170             ## reprocess
5171 7         15 next B;
5172             } elsif ($token->{type} == START_TAG_TOKEN) {
5173 7 100       46 if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) {
5174            
5175             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after html',
5176 3         19 text => $token->{tag_name}, token => $token);
5177             #
5178             } else {
5179            
5180             ## "after body" insertion mode
5181             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after body',
5182 4         20 text => $token->{tag_name}, token => $token);
5183             #
5184             }
5185              
5186 7         17 $self->{insertion_mode} = IN_BODY_IM;
5187            
5188             ## reprocess
5189 7         17 next B;
5190             } elsif ($token->{type} == END_TAG_TOKEN) {
5191 38 50       150 if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) {
5192            
5193             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after html:/',
5194 0         0 text => $token->{tag_name}, token => $token);
5195            
5196 0         0 $self->{insertion_mode} = IN_BODY_IM;
5197             ## Reprocess.
5198 0         0 next B;
5199             } else {
5200            
5201             }
5202              
5203             ## "after body" insertion mode
5204 38 100       102 if ($token->{tag_name} eq 'html') {
5205 36 50       97 if (defined $self->{inner_html_node}) {
5206            
5207 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
5208             text => 'html', token => $token);
5209             ## Ignore the token
5210 0         0 $token = $self->_get_next_token;
5211 0         0 next B;
5212             } else {
5213            
5214 36         74 $self->{insertion_mode} = AFTER_HTML_BODY_IM;
5215 36         143 $token = $self->_get_next_token;
5216 36         85 next B;
5217             }
5218             } else {
5219            
5220             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after body:/',
5221 2         11 text => $token->{tag_name}, token => $token);
5222              
5223 2         6 $self->{insertion_mode} = IN_BODY_IM;
5224             ## reprocess
5225 2         9 next B;
5226             }
5227             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
5228            
5229             ## Stop parsing
5230 36         138 last B;
5231             } else {
5232 0         0 die "$0: $token->{type}: Unknown token type";
5233             }
5234             } elsif ($self->{insertion_mode} & FRAME_IMS) {
5235 90 100       323 if ($token->{type} == CHARACTER_TOKEN) {
    100          
    100          
    50          
5236 3 100       70 if ($token->{data} =~ s/^([\x09\x0A\x0C\x20]+)//) {
5237 1         7 $self->{open_elements}->[-1]->[0]->appendTextFromUnicode($self, $1, $token);
5238            
5239 1 50       8 unless (length $token->{data}) {
5240            
5241 1         6 $token = $self->_get_next_token;
5242 1         3 next B;
5243             }
5244             }
5245            
5246 2 50       18 if ($token->{data} =~ s/^[^\x09\x0A\x0C\x20]+//) {
5247 2 100       20 if ($self->{insertion_mode} == IN_FRAMESET_IM) {
    50          
5248            
5249 1         7 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in frameset:#text', token => $token);
5250             } elsif ($self->{insertion_mode} == AFTER_FRAMESET_IM) {
5251            
5252 0         0 $self->{parse_error}->(level => $self->{level}->{must}, type => 'after frameset:#text', token => $token);
5253             } else { # "after after frameset"
5254            
5255 1         7 $self->{parse_error}->(level => $self->{level}->{must}, type => 'after html:#text', token => $token);
5256             }
5257            
5258             ## Ignore the token.
5259 2 50       8 if (length $token->{data}) {
5260            
5261             ## reprocess the rest of characters
5262             } else {
5263            
5264 2         9 $token = $self->_get_next_token;
5265             }
5266 2         4 next B;
5267             }
5268            
5269 0         0 die qq[$0: Character "$token->{data}"];
5270             } elsif ($token->{type} == START_TAG_TOKEN) {
5271 28 100 66     154 if ($token->{tag_name} eq 'frameset' and
    100 66        
    100          
5272             $self->{insertion_mode} == IN_FRAMESET_IM) {
5273            
5274            
5275             {
5276 1         3 my $el;
  1         3  
5277            
5278 1         32 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
5279            
5280 1         4 for my $attr_name (keys %{ $token->{attributes}}) {
  1         6  
5281 0         0 my $attr_t = $token->{attributes}->{$attr_name};
5282 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
5283 0         0 $attr->setValue($attr_t->{value});
5284 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
5285 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
5286 0         0 $el->setAttributeNodeNS ($attr);
5287             }
5288            
5289             $self->_data($el, manakai_source_line => $token->{line})
5290 1 50       8 if defined $token->{line};
5291             $self->_data($el, manakai_source_column => $token->{column})
5292 1 50       5 if defined $token->{column};
5293            
5294 1         8 $self->{open_elements}->[-1]->[0]->appendChild ($el);
5295 1   50     4 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  1         19  
5296             }
5297            
5298            
5299 1         4 $token = $self->_get_next_token;
5300 1         3 next B;
5301             } elsif ($token->{tag_name} eq 'frame' and
5302             $self->{insertion_mode} == IN_FRAMESET_IM) {
5303            
5304            
5305             {
5306 8         19 my $el;
  8         16  
5307            
5308 8         70 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
5309            
5310 8         18 for my $attr_name (keys %{ $token->{attributes}}) {
  8         36  
5311 0         0 my $attr_t = $token->{attributes}->{$attr_name};
5312 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
5313 0         0 $attr->setValue($attr_t->{value});
5314 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
5315 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
5316 0         0 $el->setAttributeNodeNS ($attr);
5317             }
5318            
5319             $self->_data($el, manakai_source_line => $token->{line})
5320 8 50       43 if defined $token->{line};
5321             $self->_data($el, manakai_source_column => $token->{column})
5322 8 50       34 if defined $token->{column};
5323            
5324 8         50 $self->{open_elements}->[-1]->[0]->appendChild ($el);
5325 8   50     29 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  8         131  
5326             }
5327            
5328 8         16 pop @{$self->{open_elements}};
  8         19  
5329 8         18 delete $self->{self_closing};
5330 8         92 $token = $self->_get_next_token;
5331 8         21 next B;
5332             } elsif ($token->{tag_name} eq 'noframes') {
5333            
5334             ## NOTE: As if in head.
5335 8         31 $parse_rcdata->($self, $insert, $open_tables, 0); # RAWTEXT
5336 8         18 next B;
5337              
5338             ## NOTE: ||
5339             ## has no parse error.
5340             } else {
5341 11 100       37 if ($self->{insertion_mode} == IN_FRAMESET_IM) {
    100          
5342            
5343             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in frameset',
5344 5         37 text => $token->{tag_name}, token => $token);
5345             } elsif ($self->{insertion_mode} == AFTER_FRAMESET_IM) {
5346            
5347             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after frameset',
5348 5         16 text => $token->{tag_name}, token => $token);
5349             } else { # "after after frameset"
5350            
5351             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after after frameset',
5352 1         8 text => $token->{tag_name}, token => $token);
5353             }
5354             ## Ignore the token
5355            
5356 11         40 $token = $self->_get_next_token;
5357 11         28 next B;
5358             }
5359             } elsif ($token->{type} == END_TAG_TOKEN) {
5360 30 100 66     141 if ($token->{tag_name} eq 'frameset' and
    100 66        
5361             $self->{insertion_mode} == IN_FRAMESET_IM) {
5362 14 50 33     51 if ($self->{open_elements}->[-1]->[1] == HTML_EL and
5363 0         0 @{$self->{open_elements}} == 1) {
5364            
5365             $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag',
5366 0         0 text => $token->{tag_name}, token => $token);
5367             ## Ignore the token
5368 0         0 $token = $self->_get_next_token;
5369             } else {
5370            
5371 14         28 pop @{$self->{open_elements}};
  14         31  
5372 14         54 $token = $self->_get_next_token;
5373             }
5374              
5375 14 100 66     111 if (not defined $self->{inner_html_node} and
5376             not ($self->{open_elements}->[-1]->[1] == FRAMESET_EL)) {
5377            
5378 13         29 $self->{insertion_mode} = AFTER_FRAMESET_IM;
5379             } else {
5380            
5381             }
5382 14         30 next B;
5383             } elsif ($token->{tag_name} eq 'html' and
5384             $self->{insertion_mode} == AFTER_FRAMESET_IM) {
5385            
5386 10         19 $self->{insertion_mode} = AFTER_HTML_FRAMESET_IM;
5387 10         31 $token = $self->_get_next_token;
5388 10         23 next B;
5389             } else {
5390 6 100       35 if ($self->{insertion_mode} == IN_FRAMESET_IM) {
    100          
5391            
5392             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in frameset:/',
5393 3         14 text => $token->{tag_name}, token => $token);
5394             } elsif ($self->{insertion_mode} == AFTER_FRAMESET_IM) {
5395            
5396             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after frameset:/',
5397 2         10 text => $token->{tag_name}, token => $token);
5398             } else { # "after after html"
5399            
5400             $self->{parse_error}->(level => $self->{level}->{must}, type => 'after after frameset:/',
5401 1         6 text => $token->{tag_name}, token => $token);
5402             }
5403             ## Ignore the token
5404 6         20 $token = $self->_get_next_token;
5405 6         16 next B;
5406             }
5407             } elsif ($token->{type} == END_OF_FILE_TOKEN) {
5408 29 100 66     96 unless ($self->{open_elements}->[-1]->[1] == HTML_EL and
5409 13         45 @{$self->{open_elements}} == 1) { # redundant, maybe
5410            
5411 16         53 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in body:#eof', token => $token);
5412             } else {
5413            
5414             }
5415            
5416             ## Stop parsing
5417 29         111 last B;
5418             } else {
5419 0         0 die "$0: $token->{type}: Unknown token type";
5420             }
5421             } else {
5422 0         0 die "$0: $self->{insertion_mode}: Unknown insertion mode";
5423             }
5424              
5425             ## "in body" insertion mode
5426 1520 100       3712 if ($token->{type} == START_TAG_TOKEN) {
    50          
5427 1148 100 100     36588 if ($token->{tag_name} eq 'script') {
    100 66        
    100 100        
    100 100        
    100 100        
    100 100        
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
5428            
5429             ## NOTE: This is an "as if in head" code clone
5430 29         97 $script_start_tag->($self, $insert, $open_tables);
5431 29         67 next B;
5432             } elsif ($token->{tag_name} eq 'style') {
5433            
5434             ## NOTE: This is an "as if in head" code clone
5435 6         32 $parse_rcdata->($self, $insert, $open_tables, 0); # RAWTEXT
5436 6         12 next B;
5437             } elsif ({
5438             base => 1, command => 1, link => 1, basefont => 1, bgsound => 1,
5439             }->{$token->{tag_name}}) {
5440            
5441             ## NOTE: This is an "as if in head" code clone, only "-t" differs
5442            
5443             {
5444 10         25 my $el;
  10         19  
5445            
5446 10         90 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
5447            
5448 10         22 for my $attr_name (keys %{ $token->{attributes}}) {
  10         51  
5449 1         3 my $attr_t = $token->{attributes}->{$attr_name};
5450 1         8 my $attr = $self->{document}->createAttributeNS (undef, $attr_name);
5451 1         6 $attr->setValue($attr_t->{value});
5452 1         6 $self->_data($attr, manakai_source_line => $attr_t->{line});
5453 1         5 $self->_data($attr, manakai_source_column => $attr_t->{column});
5454 1         8 $el->setAttributeNodeNS ($attr);
5455             }
5456            
5457             $self->_data($el, manakai_source_line => $token->{line})
5458 10 50       54 if defined $token->{line};
5459             $self->_data($el, manakai_source_column => $token->{column})
5460 10 50       47 if defined $token->{column};
5461            
5462 10         30 $insert->($self, $el, $open_tables);
5463 10   50     39 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  10         162  
5464             }
5465            
5466 10         22 pop @{$self->{open_elements}};
  10         19  
5467 10         26 delete $self->{self_closing};
5468 10         117 $token = $self->_get_next_token;
5469 10         39 next B;
5470             } elsif ($token->{tag_name} eq 'meta') {
5471             ## NOTE: This is an "as if in head" code clone, only "-t" differs
5472            
5473             {
5474 9         34 my $el;
  9         30  
5475            
5476 9         86 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
5477            
5478 9         25 for my $attr_name (keys %{ $token->{attributes}}) {
  9         51  
5479 5         15 my $attr_t = $token->{attributes}->{$attr_name};
5480 5         38 my $attr = $self->{document}->createAttributeNS (undef, $attr_name);
5481 5         26 $attr->setValue($attr_t->{value});
5482 5         18 $self->_data($attr, manakai_source_line => $attr_t->{line});
5483 5         17 $self->_data($attr, manakai_source_column => $attr_t->{column});
5484 5         40 $el->setAttributeNodeNS ($attr);
5485             }
5486            
5487             $self->_data($el, manakai_source_line => $token->{line})
5488 9 50       52 if defined $token->{line};
5489             $self->_data($el, manakai_source_column => $token->{column})
5490 9 50       70 if defined $token->{column};
5491            
5492 9         40 $insert->($self, $el, $open_tables);
5493 9   50     57 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  9         137  
5494             }
5495            
5496 9         21 my $meta_el = pop @{$self->{open_elements}};
  9         26  
5497              
5498 9 50       44 unless ($self->{confident}) {
5499 9 50 66     71 if ($token->{attributes}->{charset}) {
    100          
5500            
5501             ## NOTE: Whether the encoding is supported or not is
5502             ## handled in the {change_encoding} callback.
5503             $self->{change_encoding}
5504 0         0 ->($self, $token->{attributes}->{charset}->{value}, $token);
5505            
5506             $self->_data($meta_el->[0]->getAttributeNodeNS(undef, 'charset'),
5507 0         0 manakai_has_reference => $token->{attributes}->{charset}->{has_reference});
5508            
5509             } elsif ($token->{attributes}->{content} and
5510             $token->{attributes}->{'http-equiv'}) {
5511 2 50 33     64 if ($token->{attributes}->{'http-equiv'}->{value}
5512             =~ /\A[Cc][Oo][Nn][Tt][Ee][Nn][Tt]-[Tt][Yy][Pp][Ee]\z/ and
5513             $token->{attributes}->{content}->{value}
5514             =~ /[Cc][Hh][Aa][Rr][Ss][Ee][Tt]
5515             [\x09\x0A\x0C\x0D\x20]*=
5516             [\x09\x0A\x0C\x0D\x20]*(?>"([^"]*)"|'([^']*)'|
5517             ([^"'\x09\x0A\x0C\x0D\x20][^\x09\x0A\x0C\x0D\x20\x3B]*))
5518             /x) {
5519            
5520             ## NOTE: Whether the encoding is supported or not is handled
5521             ## in the {change_encoding} callback.
5522             $self->{change_encoding}
5523 2 50       15 ->($self, defined $1 ? $1 : defined $2 ? $2 : $3, $token);
    50          
5524             $self->_data($meta_el->[0]->getAttributeNodeNS(undef, 'content'),
5525 2         32 manakai_has_reference => $token->{attributes}->{content}->{has_reference});
5526             }
5527             }
5528             } else {
5529 0 0       0 if ($token->{attributes}->{charset}) {
5530            
5531             $self->_data($meta_el->[0]->getAttributeNodeNS(undef, 'charset'),
5532 0         0 manakai_has_reference => $token->{attributes}->{charset}->{has_reference});
5533             }
5534 0 0       0 if ($token->{attributes}->{content}) {
5535            
5536             $self->_data($meta_el->[0]->getAttributeNodeNS (undef, 'content'),
5537 0         0 manakai_has_reference => $token->{attributes}->{content}->{has_reference});
5538             }
5539             }
5540              
5541 9         24 delete $self->{self_closing};
5542 9         41 $token = $self->_get_next_token;
5543 9         49 next B;
5544             } elsif ($token->{tag_name} eq 'title') {
5545            
5546             ## NOTE: This is an "as if in head" code clone
5547 10         71 $parse_rcdata->($self, $insert, $open_tables, 1); # RCDATA
5548 10         37 next B;
5549            
5550             } elsif ($token->{tag_name} eq 'body') {
5551             ## "In body" insertion mode, "body" start tag token.
5552 7         64 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in body', text => 'body', token => $token);
5553            
5554 7 50 33     13 if (@{$self->{open_elements}} == 1 or
  7         86  
5555             not ($self->{open_elements}->[1]->[1] == BODY_EL)) {
5556            
5557             ## Ignore the token
5558             } else {
5559 7         20 delete $self->{frameset_ok};
5560 7         18 my $body_el = $self->{open_elements}->[1]->[0];
5561 7         15 for my $attr_name (keys %{$token->{attributes}}) {
  7         39  
5562 6 100       66 unless ($body_el->hasAttribute($attr_name)) {
5563            
5564             $body_el->setAttribute($attr_name,
5565 5         25 $token->{attributes}->{$attr_name}->{value});
5566             }
5567             }
5568             }
5569            
5570 7         71 $token = $self->_get_next_token;
5571 7         26 next B;
5572             } elsif ($token->{tag_name} eq 'frameset') {
5573             $self->{parse_error}->(level => $self->{level}->{must}, type => 'in body', text => $token->{tag_name},
5574 39         196 token => $token);
5575              
5576 39 50 33     62 if (@{$self->{open_elements}} == 1 or
  39 100       217  
5577             not ($self->{open_elements}->[1]->[1] == BODY_EL)) {
5578            
5579             ## Ignore the token.
5580             } elsif (not $self->{frameset_ok}) {
5581            
5582             ## Ignore the token.
5583             } else {
5584            
5585            
5586             ## 1. Remove the second element.
5587 10         24 my $body = $self->{open_elements}->[1]->[0];
5588 10         47 my $body_parent = $body->parentNode;
5589 10 50       42 $body_parent->removeChild ($body) if $body_parent;
5590              
5591             ## 2. Pop nodes.
5592 10         127 splice @{$self->{open_elements}}, 1;
  10         146  
5593              
5594             ## 3. Insert.
5595            
5596             {
5597 10         41 my $el;
  10         49  
5598            
5599 10         71 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
5600            
5601 10         34 for my $attr_name (keys %{ $token->{attributes}}) {
  10         61  
5602 0         0 my $attr_t = $token->{attributes}->{$attr_name};
5603 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
5604 0         0 $attr->setValue($attr_t->{value});
5605 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
5606 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
5607 0         0 $el->setAttributeNodeNS ($attr);
5608             }
5609            
5610             $self->_data($el, manakai_source_line => $token->{line})
5611 10 50       60 if defined $token->{line};
5612             $self->_data($el, manakai_source_column => $token->{column})
5613 10 50       63 if defined $token->{column};
5614            
5615 10         42 $insert->($self, $el, $open_tables);
5616 10   50     31 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  10         157  
5617             }
5618            
5619              
5620             ## 4. Switch.
5621 10         29 $self->{insertion_mode} = IN_FRAMESET_IM;
5622             }
5623              
5624            
5625 39         303 $token = $self->_get_next_token;
5626 39         113 next B;
5627            
5628             } elsif ({
5629             ## "In body" insertion mode, non-phrasing flow-content
5630             ## elements start tags.
5631             address => 1, article => 1, aside => 1, blockquote => 1,
5632             center => 1, details => 1, dir => 1, div => 1, dl => 1,
5633             fieldset => 1, figcaption => 1, figure => 1, footer => 1,
5634             header => 1, hgroup => 1, menu => 1, nav => 1, ol => 1,
5635             p => 1, section => 1, ul => 1, summary => 1,
5636             # datagrid => 1,
5637              
5638             ## Closing any heading element
5639             h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1,
5640              
5641             ## Ignoring any leading newline in content
5642             pre => 1, listing => 1,
5643              
5644             ## Form element pointer
5645             form => 1,
5646            
5647             ## A quirk & switching of insertion mode
5648             table => 1,
5649              
5650             ## Void element
5651             hr => 1,
5652             }->{$token->{tag_name}}) {
5653              
5654             ## 1. When there is an opening |form| element:
5655 455 100 100     1564 if ($token->{tag_name} eq 'form' and defined $self->{form_element}) {
5656            
5657 1         6 $self->{parse_error}->(level => $self->{level}->{must}, type => 'in form:form', token => $token);
5658             ## Ignore the token
5659            
5660 1         5 $token = $self->_get_next_token;
5661 1         6 next B;
5662             }
5663              
5664             ## 2. Close the |p| element, if any.
5665 454 100 100     1567 if ($token->{tag_name} ne 'table' or # The Hixie Quirk
      100        
5666             ($self->_data($self->{document})->{'manakai_compat_mode'}||'') ne 'quirks') {
5667             ## "have a |p| element in button scope"
5668 406         710 INSCOPE: for (reverse @{$self->{open_elements}}) {
  406         1069  
5669 859 100       2389 if ($_->[1] == P_EL) {
    100          
5670            
5671            
5672 19         60 $token->{self_closing} = $self->{self_closing};
5673 19         44 unshift @{$self->{token}}, $token;
  19         56  
5674 19         46 delete $self->{self_closing};
5675             #
5676             $token = {type => END_TAG_TOKEN, tag_name => 'p',
5677 19         78 line => $token->{line}, column => $token->{column}};
5678 19         84 next B;
5679             } elsif ($_->[1] & BUTTON_SCOPING_EL) {
5680            
5681 387         922 last INSCOPE;
5682             }
5683             } # INSCOPE
5684             }
5685              
5686             ## 3. Close the opening element, if any.
5687 435 100       2453 if ({h1 => 1, h2 => 1, h3 => 1,
5688             h4 => 1, h5 => 1, h6 => 1}->{$token->{tag_name}}) {
5689 11 50       38 if ($self->{open_elements}->[-1]->[1] == HEADING_EL) {
5690             $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
5691 0         0 text => $self->{open_elements}->[-1]->[0]->tagName,
5692             token => $token);
5693 0         0 pop @{$self->{open_elements}};
  0         0  
5694             }
5695             }
5696              
5697             ## 4. Insertion.
5698            
5699             {
5700 435         1113 my $el;
  435         680  
5701            
5702 435         3681 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
5703            
5704 435         903 for my $attr_name (keys %{ $token->{attributes}}) {
  435         1755  
5705 16         95 $attr_name =~ s/[^A-Za-z0-9:_-]//g;
5706 16         39 my $attr_t = $token->{attributes}->{$attr_name};
5707 16         196 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
5708 16         121 $attr->setValue($attr_t->{value});
5709 16         122 $self->_data($attr, manakai_source_line => $attr_t->{line});
5710 16         69 $self->_data($attr, manakai_source_column => $attr_t->{column});
5711 16         152 $el->setAttributeNodeNS($attr);
5712             }
5713            
5714             $self->_data($el, manakai_source_line => $token->{line})
5715 435 50       2395 if defined $token->{line};
5716             $self->_data($el, manakai_source_column => $token->{column})
5717 435 50       1677 if defined $token->{column};
5718            
5719 435         1204 $insert->($self, $el, $open_tables);
5720 435   50     2146 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
  435         7076  
5721             }
5722            
5723 435 100 100     2838 if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') {
    100          
    100          
    100          
5724            
5725 16         65 $token = $self->_get_next_token;
5726 16 100       56 if ($token->{type} == CHARACTER_TOKEN) {
5727 10         44 $token->{data} =~ s/^\x0A//;
5728 10 100       28 unless (length $token->{data}) {
5729            
5730 3         11 $token = $self->_get_next_token;
5731             } else {
5732            
5733             }
5734             } else {
5735            
5736             }
5737              
5738 16         31 delete $self->{frameset_ok};
5739             } elsif ($token->{tag_name} eq 'form') {
5740            
5741 15         41 $self->{form_element} = $self->{open_elements}->[-1]->[0];
5742              
5743            
5744 15         59 $token = $self->_get_next_token;
5745             } elsif ($token->{tag_name} eq 'table') {
5746            
5747 129         233 push @{$open_tables}, [$self->{open_elements}->[-1]->[0]];
  129         503  
5748              
5749 129         430 delete $self->{frameset_ok};
5750            
5751 129         231 $self->{insertion_mode} = IN_TABLE_IM;
5752              
5753            
5754 129         476 $token = $self->_get_next_token;
5755             } elsif ($token->{tag_name} eq 'hr') {
5756            
5757 17         38 pop @{$self->{open_elements}};
  17         36  
5758            
5759 17         41 delete $self->{self_closing};
5760              
5761 17         188 delete $self->{frameset_ok};
5762              
5763 17         60 $token = $self->_get_next_token;
5764             } else {
5765            
5766 258         967 $token = $self->_get_next_token;
5767             }
5768 435         2338 next B;
5769             } elsif ($token->{tag_name} eq 'li') {
5770             ## "In body" insertion mode, "li" start tag. As normal, but
5771             ## imply when there's another
  • .
  • 5772              
    5773             ## NOTE: Special, Scope (
  • ==
  • )::
    5774             ## Interpreted as
  • (non-conforming):
  • 5775             ## blockquote (O9.27), center (O), dd (Fx3, O, S3.1.2, IE7),
    5776             ## dt (Fx, O, S, IE), dl (O), fieldset (O, S, IE), form (Fx, O, S),
    5777             ## hn (O), pre (O), applet (O, S), button (O, S), marquee (Fx, O, S),
    5778             ## object (Fx)
    5779             ## Generate non-tree (non-conforming):
    5780             ## basefont (IE7 (where basefont is non-void)), center (IE),
    5781             ## form (IE), hn (IE)
    5782             ## address, div, p (
  • ==
  • )::
  • 5783             ## Interpreted as
  • (non-conforming):
    5784             ## div (Fx, S)
    5785              
    5786             ## 1. Frameset-ng
    5787 15         49 delete $self->{frameset_ok};
    5788              
    5789 15         32 my $non_optional;
    5790 15         36 my $i = -1;
    5791              
    5792             ## 2.
    5793 15         30 for my $node (reverse @{$self->{open_elements}}) {
      15         44  
    5794 19 100 66     172 if ($node->[1] == LI_EL) {
        100 100        
        100          
    5795             ## 3. (a) As if
    5796             {
    5797             ## If no - not applied
    5798             #
    5799              
    5800             ## Otherwise
    5801              
    5802             ## 1. generate implied end tags, except for
    5803             #
    5804              
    5805             ## 2. If current node != "li", parse error
    5806 2 100       5 if ($non_optional) {
      2         9  
    5807 1         12 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
    5808             text => $non_optional->[0]->tagName,
    5809             token => $token);
    5810            
    5811             } else {
    5812            
    5813             }
    5814              
    5815             ## 3. Pop
    5816 2         5 splice @{$self->{open_elements}}, $i;
      2         8  
    5817             }
    5818              
    5819 2         10 last; ## 3. (b) goto 5.
    5820             } elsif (
    5821             ## NOTE: "special" category
    5822             ($node->[1] & SPECIAL_EL or
    5823             $node->[1] & SCOPING_EL) and
    5824             ## NOTE: "li", "dt", and "dd" are in |SPECIAL_EL|.
    5825             (not $node->[1] & ADDRESS_DIV_P_EL)
    5826             ) {
    5827             ## 4.
    5828            
    5829 13         33 last; ## goto 6.
    5830             } elsif ($node->[1] & END_TAG_OPTIONAL_EL) {
    5831            
    5832             #
    5833             } else {
    5834            
    5835 2   33     22 $non_optional ||= $node;
    5836             #
    5837             }
    5838             ## 5.
    5839             ## goto 3.
    5840 4         11 $i--;
    5841             }
    5842              
    5843             ## 6. (a) "have a |p| element in button scope".
    5844 15         64 INSCOPE: for (reverse @{$self->{open_elements}}) {
      15         52  
    5845 39 100       126 if ($_->[1] == P_EL) {
        100          
    5846            
    5847              
    5848             ## NOTE: |

  • |, for example.
  • 5849              
    5850            
    5851 1         4 $token->{self_closing} = $self->{self_closing};
    5852 1         2 unshift @{$self->{token}}, $token;
      1         4  
    5853 1         2 delete $self->{self_closing};
    5854             #
    5855             $token = {type => END_TAG_TOKEN, tag_name => 'p',
    5856 1         5 line => $token->{line}, column => $token->{column}};
    5857 1         4 next B;
    5858             } elsif ($_->[1] & BUTTON_SCOPING_EL) {
    5859            
    5860 14         61 last INSCOPE;
    5861             }
    5862             } # INSCOPE
    5863              
    5864             ## 6. (b) insert
    5865            
    5866             {
    5867 14         28 my $el;
      14         34  
    5868            
    5869 14         147 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
    5870            
    5871 14         44 for my $attr_name (keys %{ $token->{attributes}}) {
      14         83  
    5872 0         0 my $attr_t = $token->{attributes}->{$attr_name};
    5873 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
    5874 0         0 $attr->setValue($attr_t->{value});
    5875 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
    5876 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
    5877 0         0 $el->setAttributeNodeNS ($attr);
    5878             }
    5879            
    5880             $self->_data($el, manakai_source_line => $token->{line})
    5881 14 50       99 if defined $token->{line};
    5882             $self->_data($el, manakai_source_column => $token->{column})
    5883 14 50       102 if defined $token->{column};
    5884            
    5885 14         57 $insert->($self, $el, $open_tables);
    5886 14   50     53 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
      14         273  
    5887             }
    5888            
    5889            
    5890 14         62 $token = $self->_get_next_token;
    5891 14         95 next B;
    5892              
    5893             } elsif ($token->{tag_name} eq 'dt' or $token->{tag_name} eq 'dd') {
    5894             ## "In body" insertion mode, "dt" or "dd" start tag. As
    5895             ## normal, but imply or when there's antoher
    5896             ## or
    .
    5897              
    5898             ## 1. Frameset-ng
    5899 19         50 delete $self->{frameset_ok};
    5900              
    5901 19         44 my $non_optional;
    5902 19         36 my $i = -1;
    5903              
    5904             ## 2.
    5905 19         39 for my $node (reverse @{$self->{open_elements}}) {
      19         58  
    5906 24 100 66     182 if ($node->[1] == DTDD_EL) {
        100 100        
        100          
    5907             ## 3. (a) As if
    5908             {
    5909             ## If no - not applied
    5910             #
    5911              
    5912             ## Otherwise
    5913              
    5914             ## 1. generate implied end tags, except for or
    5915             #
    5916              
    5917             ## 2. If current node != "dt"|"dd", parse error
    5918 6 100       13 if ($non_optional) {
      6         19  
    5919 2         20 $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed',
    5920             text => $non_optional->[0]->tagName,
    5921             token => $token);
    5922            
    5923             } else {
    5924            
    5925             }
    5926              
    5927             ## 3. Pop
    5928 6         15 splice @{$self->{open_elements}}, $i;
      6         26  
    5929             }
    5930              
    5931 6         29 last; ## 3. (b) goto 5.
    5932             } elsif (
    5933             ## NOTE: "special" category
    5934             ($node->[1] & SPECIAL_EL or $node->[1] & SCOPING_EL) and
    5935             ## NOTE: "li", "dt", and "dd" are in |SPECIAL_EL|.
    5936              
    5937             (not $node->[1] & ADDRESS_DIV_P_EL)
    5938             ) {
    5939             ## 4.
    5940            
    5941 13         27 last; ## goto 5.
    5942             } elsif ($node->[1] & END_TAG_OPTIONAL_EL) {
    5943            
    5944             #
    5945             } else {
    5946            
    5947 3   33     19 $non_optional ||= $node;
    5948             #
    5949             }
    5950             ## 5.
    5951             ## goto 3.
    5952 5         16 $i--;
    5953             }
    5954              
    5955             ## 6. (a) "have a |p| element in button scope".
    5956 19         111 INSCOPE: for (reverse @{$self->{open_elements}}) {
      19         46  
    5957 37 100       124 if ($_->[1] == P_EL) {
        100          
    5958            
    5959            
    5960 2         6 $token->{self_closing} = $self->{self_closing};
    5961 2         4 unshift @{$self->{token}}, $token;
      2         7  
    5962 2         4 delete $self->{self_closing};
    5963             #
    5964             $token = {type => END_TAG_TOKEN, tag_name => 'p',
    5965 2         9 line => $token->{line}, column => $token->{column}};
    5966 2         21 next B;
    5967             } elsif ($_->[1] & BUTTON_SCOPING_EL) {
    5968            
    5969 17         37 last INSCOPE;
    5970             }
    5971             } # INSCOPE
    5972              
    5973             ## 6. (b) insert
    5974            
    5975             {
    5976 17         64 my $el;
      17         32  
    5977            
    5978 17         177 $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name});
    5979            
    5980 17         47 for my $attr_name (keys %{ $token->{attributes}}) {
      17         101  
    5981 0         0 my $attr_t = $token->{attributes}->{$attr_name};
    5982 0         0 my $attr = $self->{document}->createAttributeNS(undef, $attr_name);
    5983 0         0 $attr->setValue($attr_t->{value});
    5984 0         0 $self->_data($attr, manakai_source_line => $attr_t->{line});
    5985 0         0 $self->_data($attr, manakai_source_column => $attr_t->{column});
    5986 0         0 $el->setAttributeNodeNS ($attr);
    5987             }
    5988            
    5989             $self->_data($el, manakai_source_line => $token->{line})
    5990 17 50       127 if defined $token->{line};
    5991             $self->_data($el, manakai_source_column => $token->{column})
    5992 17 50       92 if defined $token->{column};
    5993            
    5994 17         64 $insert->($self, $el, $open_tables);
    5995 17   50     64 push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0];
      17         291  
    5996             }
    5997            
    5998            
    5999 17         69 $token = $self->_get_next_token;
    6000 17         129 next B;
    6001            
    6002             } elsif ($token->{tag_name} eq 'plaintext') {
    6003             ## "In body" insertion mode, "plaintext" start tag. As
    6004             ## normal, but effectively ends parsing.
    6005              
    6006             ## has a p element in scope
    6007 15         42 INSCOPE: for (reverse @{$self->{open_elements}}) {
      15         46  
    6008 27 100       89 if ($_->[1] == P_EL) {
        100          
    6009            
    6010            
    6011 2         8 $token->{self_closing} = $self->{self_closing};
    6012 2         5 unshift @{$self->{token}}, $token;
      2         7  
    6013 2         4 delete $self->{self_closing};
    6014             # </td> </tr> <tr> <td class="h" > <a name="6015">6015</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token = {type => END_TAG_TOKEN, tag_name => 'p', </td> </tr> <tr> <td class="h" > <a name="6016">6016</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 12 </td> <td class="s"> line => $token->{line}, column => $token->{column}}; </td> </tr> <tr> <td class="h" > <a name="6017">6017</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6018">6018</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($_->[1] & BUTTON_SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6019">6019</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6020">6020</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 30 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6021">6021</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6022">6022</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6023">6023</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6024">6024</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6025">6025</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6026">6026</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 25 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 23 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6027">6027</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6028">6028</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 111 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6029">6029</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6030">6030</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 35 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 54 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6031">6031</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6032">6032</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS(undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6033">6033</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6034">6034</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6035">6035</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6036">6036</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6037">6037</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6038">6038</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6039">6039</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6040">6040</a> </td> <td class="c3" > 13 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6040-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 68 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6041">6041</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6042">6042</a> </td> <td class="c3" > 13 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6042-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 69 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6043">6043</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6044">6044</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 50 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6045">6045</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6045-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 115 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 173 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6046">6046</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6047">6047</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6048">6048</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 33 </td> <td class="s"> $self->{state} = PLAINTEXT_STATE; </td> </tr> <tr> <td class="h" > <a name="6049">6049</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6050">6050</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6051">6051</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 53 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6052">6052</a> </td> <td class="c3" > 13 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 81 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6053">6053</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6054">6054</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'a') { </td> </tr> <tr> <td class="h" > <a name="6055">6055</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 144 </td> <td class="s"> AFE: for my $i (reverse 0..$#$active_formatting_elements) { </td> </tr> <tr> <td class="h" > <a name="6056">6056</a> </td> <td class="c3" > 14 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 69 </td> <td class="s"> my $node = $active_formatting_elements->[$i]; </td> </tr> <tr> <td class="h" > <a name="6057">6057</a> </td> <td class="c3" > 11 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#6057-1"> 11 </a> </td> <td > &nbsp; </td> <td > 181 </td> <td class="s"> no warnings; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 11 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 30 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 11 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 177911 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6058">6058</a> </td> <td class="c3" > 14 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6058-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 61 </td> <td class="s"> if ($node->[1] == A_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6059">6059</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6060">6060</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 15 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'in a:a', token => $token); </td> </tr> <tr> <td class="h" > <a name="6061">6061</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6062">6062</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6063">6063</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> $token->{self_closing} = $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6064">6064</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> unshift @{$self->{token}}, $token; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6065">6065</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6066">6066</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # <a> </td> </tr> <tr> <td class="h" > <a name="6067">6067</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token = {type => END_TAG_TOKEN, tag_name => 'a', </td> </tr> <tr> <td class="h" > <a name="6068">6068</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 10 </td> <td class="s"> line => $token->{line}, column => $token->{column}}; </td> </tr> <tr> <td class="h" > <a name="6069">6069</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> $formatting_end_tag->($self, $active_formatting_elements, </td> </tr> <tr> <td class="h" > <a name="6070">6070</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $open_tables, $token); </td> </tr> <tr> <td class="h" > <a name="6071">6071</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6072">6072</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 28 </td> <td class="s"> AFE2: for (reverse 0..$#$active_formatting_elements) { </td> </tr> <tr> <td class="h" > <a name="6073">6073</a> </td> <td class="c0" > <a href="#6075"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6073-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($active_formatting_elements->[$_]->[0] eq $node->[0]) { </td> </tr> <tr> <td class="h" > <a name="6074">6074</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6075">6075</a> </td> <td class="c0" > <a href="#6076"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> splice @$active_formatting_elements, $_, 1; </td> </tr> <tr> <td class="h" > <a name="6076">6076</a> </td> <td class="c0" > <a href="#6082"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> last AFE2; </td> </tr> <tr> <td class="h" > <a name="6077">6077</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6078">6078</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # AFE2 </td> </tr> <tr> <td class="h" > <a name="6079">6079</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> OE: for (reverse 0..$#{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6080">6080</a> </td> <td class="c3" > 7 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6080-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 59 </td> <td class="s"> if ($self->{open_elements}->[$_]->[0] eq $node->[0]) { </td> </tr> <tr> <td class="h" > <a name="6081">6081</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6082">6082</a> </td> <td class="c0" > <a href="#&nbsp;"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> splice @{$self->{open_elements}}, $_, 1; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c0" > <a href="#6083"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6083">6083</a> </td> <td class="c0" > <a href="#6089"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> last OE; </td> </tr> <tr> <td class="h" > <a name="6084">6084</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6085">6085</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # OE </td> </tr> <tr> <td class="h" > <a name="6086">6086</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> last AFE; </td> </tr> <tr> <td class="h" > <a name="6087">6087</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[0] eq '#marker') { </td> </tr> <tr> <td class="h" > <a name="6088">6088</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6089">6089</a> </td> <td class="c0" > <a href="#6166"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> last AFE; </td> </tr> <tr> <td class="h" > <a name="6090">6090</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6091">6091</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # AFE </td> </tr> <tr> <td class="h" > <a name="6092">6092</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6093">6093</a> </td> <td class="c3" > 34 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6093-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 202 </td> <td class="s"> my $insert = $self->{insertion_mode} & TABLE_IMS </td> </tr> <tr> <td class="h" > <a name="6094">6094</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ? $insert_to_foster : $insert_to_current; </td> </tr> <tr> <td class="h" > <a name="6095">6095</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 116 </td> <td class="s"> $reconstruct_active_formatting_elements </td> </tr> <tr> <td class="h" > <a name="6096">6096</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->($self, $insert, $active_formatting_elements, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6097">6097</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6098">6098</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6099">6099</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6100">6100</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 71 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 58 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6101">6101</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6102">6102</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 303 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6103">6103</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6104">6104</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 83 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 155 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6105">6105</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 14 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6106">6106</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 42 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS (undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6107">6107</a> </td> <td class="c3" > 5 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6107-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 105 </td> <td class="s"> if ($attr) </td> </tr> <tr> <td class="h" > <a name="6108">6108</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6109">6109</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 55 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6110">6110</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 22 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6111">6111</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 36 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6112">6112</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 48 </td> <td class="s"> $el->setAttributeNodeNS($attr); </td> </tr> <tr> <td class="h" > <a name="6113">6113</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6114">6114</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6115">6115</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6116">6116</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6117">6117</a> </td> <td class="c3" > 34 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6117-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 184 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6118">6118</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6119">6119</a> </td> <td class="c3" > 34 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6119-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 169 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6120">6120</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6121">6121</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 110 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6122">6122</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6122-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 145 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 508 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6123">6123</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6124">6124</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6125">6125</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> push @$active_formatting_elements, </td> </tr> <tr> <td class="h" > <a name="6126">6126</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> [$self->{open_elements}->[-1]->[0], </td> </tr> <tr> <td class="h" > <a name="6127">6127</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 121 </td> <td class="s"> $self->{open_elements}->[-1]->[1], </td> </tr> <tr> <td class="h" > <a name="6128">6128</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token]; </td> </tr> <tr> <td class="h" > <a name="6129">6129</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6130">6130</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6131">6131</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 125 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6132">6132</a> </td> <td class="c3" > 34 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 207 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6133">6133</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'nobr') { </td> </tr> <tr> <td class="h" > <a name="6134">6134</a> </td> <td class="c3" > 68 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6134-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 208 </td> <td class="s"> my $insert = $self->{insertion_mode} & TABLE_IMS </td> </tr> <tr> <td class="h" > <a name="6135">6135</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ? $insert_to_foster : $insert_to_current; </td> </tr> <tr> <td class="h" > <a name="6136">6136</a> </td> <td class="c3" > 68 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 215 </td> <td class="s"> $reconstruct_active_formatting_elements </td> </tr> <tr> <td class="h" > <a name="6137">6137</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->($self, $insert, $active_formatting_elements, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6138">6138</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6139">6139</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## has a |nobr| element in scope </td> </tr> <tr> <td class="h" > <a name="6140">6140</a> </td> <td class="c3" > 68 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 297 </td> <td class="s"> INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 68 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 214 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6141">6141</a> </td> <td class="c3" > 156 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 263 </td> <td class="s"> my $node = $self->{open_elements}->[$_]; </td> </tr> <tr> <td class="h" > <a name="6142">6142</a> </td> <td class="c3" > 156 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6142-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 407 </td> <td class="s"> if ($node->[1] == NOBR_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6143">6143</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6144">6144</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 104 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'in nobr:nobr', token => $token); </td> </tr> <tr> <td class="h" > <a name="6145">6145</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6146">6146</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 65 </td> <td class="s"> $token->{self_closing} = $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6147">6147</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 47 </td> <td class="s"> unshift @{$self->{token}}, $token; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 65 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6148">6148</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 66 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6149">6149</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # <nobr> </td> </tr> <tr> <td class="h" > <a name="6150">6150</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token = {type => END_TAG_TOKEN, tag_name => 'nobr', </td> </tr> <tr> <td class="h" > <a name="6151">6151</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 95 </td> <td class="s"> line => $token->{line}, column => $token->{column}}; </td> </tr> <tr> <td class="h" > <a name="6152">6152</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 146 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6153">6153</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[1] & SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6154">6154</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6155">6155</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 80 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6156">6156</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6157">6157</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6158">6158</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6159">6159</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6160">6160</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6161">6161</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 77 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 61 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6162">6162</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6163">6163</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 349 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6164">6164</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6165">6165</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 86 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 189 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6166">6166</a> </td> <td class="c0" > <a href="#6167"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6167">6167</a> </td> <td class="c0" > <a href="#6168"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS(undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6168">6168</a> </td> <td class="c0" > <a href="#6169"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6169">6169</a> </td> <td class="c0" > <a href="#6170"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6170">6170</a> </td> <td class="c0" > <a href="#6171"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6171">6171</a> </td> <td class="c0" > <a href="#6223"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6172">6172</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6173">6173</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6174">6174</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6175">6175</a> </td> <td class="c3" > 42 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6175-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 207 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6176">6176</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6177">6177</a> </td> <td class="c3" > 42 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6177-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 160 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6178">6178</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6179">6179</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 126 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6180">6180</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6180-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 152 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 637 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6181">6181</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6182">6182</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6183">6183</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> push @$active_formatting_elements, </td> </tr> <tr> <td class="h" > <a name="6184">6184</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> [$self->{open_elements}->[-1]->[0], </td> </tr> <tr> <td class="h" > <a name="6185">6185</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 127 </td> <td class="s"> $self->{open_elements}->[-1]->[1], </td> </tr> <tr> <td class="h" > <a name="6186">6186</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token]; </td> </tr> <tr> <td class="h" > <a name="6187">6187</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6188">6188</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 151 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6189">6189</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 235 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6190">6190</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'button') { </td> </tr> <tr> <td class="h" > <a name="6191">6191</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## has a button element in scope </td> </tr> <tr> <td class="h" > <a name="6192">6192</a> </td> <td class="c3" > 27 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 69 </td> <td class="s"> INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 27 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 95 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6193">6193</a> </td> <td class="c3" > 75 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 120 </td> <td class="s"> my $node = $self->{open_elements}->[$_]; </td> </tr> <tr> <td class="h" > <a name="6194">6194</a> </td> <td class="c3" > 75 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6194-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 209 </td> <td class="s"> if ($node->[1] == BUTTON_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6195">6195</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6196">6196</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'in button:button', token => $token); </td> </tr> <tr> <td class="h" > <a name="6197">6197</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6198">6198</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> $token->{self_closing} = $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6199">6199</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> unshift @{$self->{token}}, $token; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6200">6200</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6201">6201</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # <button> </td> </tr> <tr> <td class="h" > <a name="6202">6202</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token = {type => END_TAG_TOKEN, tag_name => 'button', </td> </tr> <tr> <td class="h" > <a name="6203">6203</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> line => $token->{line}, column => $token->{column}}; </td> </tr> <tr> <td class="h" > <a name="6204">6204</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6205">6205</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[1] & SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6206">6206</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6207">6207</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 53 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6208">6208</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6209">6209</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6210">6210</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6211">6211</a> </td> <td class="c3" > 26 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6211-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 72 </td> <td class="s"> my $insert = $self->{insertion_mode} & TABLE_IMS </td> </tr> <tr> <td class="h" > <a name="6212">6212</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ? $insert_to_foster : $insert_to_current; </td> </tr> <tr> <td class="h" > <a name="6213">6213</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 98 </td> <td class="s"> $reconstruct_active_formatting_elements </td> </tr> <tr> <td class="h" > <a name="6214">6214</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->($self, $insert, $active_formatting_elements, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6215">6215</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6216">6216</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6217">6217</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6218">6218</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 44 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 49 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6219">6219</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6220">6220</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 217 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6221">6221</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6222">6222</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 59 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 102 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6223">6223</a> </td> <td class="c0" > <a href="#6224"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6224">6224</a> </td> <td class="c0" > <a href="#6225"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS (undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6225">6225</a> </td> <td class="c0" > <a href="#6226"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6226">6226</a> </td> <td class="c0" > <a href="#6227"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6227">6227</a> </td> <td class="c0" > <a href="#6228"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6228">6228</a> </td> <td class="c0" > <a href="#6265"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6229">6229</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6230">6230</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6231">6231</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6232">6232</a> </td> <td class="c3" > 26 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6232-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 123 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6233">6233</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6234">6234</a> </td> <td class="c3" > 26 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6234-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 122 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6235">6235</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6236">6236</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 95 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6237">6237</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6237-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 95 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 440 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6238">6238</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6239">6239</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6240">6240</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6241">6241</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: associate with $self->{form_element} if defined </td> </tr> <tr> <td class="h" > <a name="6242">6242</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6243">6243</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 58 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6244">6244</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6245">6245</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6246">6246</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 109 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6247">6247</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 150 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6248">6248</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ({ </td> </tr> <tr> <td class="h" > <a name="6249">6249</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> xmp => 1, </td> </tr> <tr> <td class="h" > <a name="6250">6250</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> iframe => 1, </td> </tr> <tr> <td class="h" > <a name="6251">6251</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> noembed => 1, </td> </tr> <tr> <td class="h" > <a name="6252">6252</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> noframes => 1, ## NOTE: This is an "as if in head" code clone. </td> </tr> <tr> <td class="h" > <a name="6253">6253</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> noscript => 0, ## TODO: 1 if scripting is enabled </td> </tr> <tr> <td class="h" > <a name="6254">6254</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$token->{tag_name}}) { </td> </tr> <tr> <td class="h" > <a name="6255">6255</a> </td> <td class="c3" > 3 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6255-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> if ($token->{tag_name} eq 'xmp') { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6256">6256</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "In body" insertion mode, "xmp" start tag. As normal </td> </tr> <tr> <td class="h" > <a name="6257">6257</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## flow-content element start tag, but CDATA parsing. </td> </tr> <tr> <td class="h" > <a name="6258">6258</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6259">6259</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6260">6260</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "have a |p| element in button scope". </td> </tr> <tr> <td class="h" > <a name="6261">6261</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> INSCOPE: for (reverse @{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6262">6262</a> </td> <td class="c3" > 3 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6262-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> if ($_->[1] == P_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6263">6263</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6264">6264</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6265">6265</a> </td> <td class="c0" > <a href="#6266"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $token->{self_closing} = $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6266">6266</a> </td> <td class="c0" > <a href="#&nbsp;"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> unshift @{$self->{token}}, $token; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c0" > <a href="#6267"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6267">6267</a> </td> <td class="c0" > <a href="#6270"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6268">6268</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # <xmp> </td> </tr> <tr> <td class="h" > <a name="6269">6269</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token = {type => END_TAG_TOKEN, tag_name => 'p', </td> </tr> <tr> <td class="h" > <a name="6270">6270</a> </td> <td class="c0" > <a href="#6271"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> line => $token->{line}, column => $token->{column}}; </td> </tr> <tr> <td class="h" > <a name="6271">6271</a> </td> <td class="c0" > <a href="#6421"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6272">6272</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($_->[1] & BUTTON_SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6273">6273</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6274">6274</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6275">6275</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6276">6276</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6277">6277</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6278">6278</a> </td> <td class="c3" > 2 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6278-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> my $insert = $self->{insertion_mode} & TABLE_IMS </td> </tr> <tr> <td class="h" > <a name="6279">6279</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ? $insert_to_foster : $insert_to_current; </td> </tr> <tr> <td class="h" > <a name="6280">6280</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> $reconstruct_active_formatting_elements </td> </tr> <tr> <td class="h" > <a name="6281">6281</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->($self, $insert, $active_formatting_elements, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6282">6282</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6283">6283</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6284">6284</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'iframe') { </td> </tr> <tr> <td class="h" > <a name="6285">6285</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6286">6286</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6287">6287</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6288">6288</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6289">6289</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6290">6290</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: There is an "as if in body" code clone. </td> </tr> <tr> <td class="h" > <a name="6291">6291</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 13 </td> <td class="s"> $parse_rcdata->($self, $insert, $open_tables, 0); # RAWTEXT </td> </tr> <tr> <td class="h" > <a name="6292">6292</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 18 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6293">6293</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'isindex') { </td> </tr> <tr> <td class="h" > <a name="6294">6294</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 56 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'isindex', token => $token); </td> </tr> <tr> <td class="h" > <a name="6295">6295</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6296">6296</a> </td> <td class="c3" > 9 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6296-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 28 </td> <td class="s"> if (defined $self->{form_element}) { </td> </tr> <tr> <td class="h" > <a name="6297">6297</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6298">6298</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Ignore the token </td> </tr> <tr> <td class="h" > <a name="6299">6299</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: Not acknowledged. </td> </tr> <tr> <td class="h" > <a name="6300">6300</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 16 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6301">6301</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6302">6302</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6303">6303</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 19 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6304">6304</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6305">6305</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 15 </td> <td class="s"> my $at = $token->{attributes}; </td> </tr> <tr> <td class="h" > <a name="6306">6306</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 11 </td> <td class="s"> my $form_attrs; </td> </tr> <tr> <td class="h" > <a name="6307">6307</a> </td> <td class="c3" > 7 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6307-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 25 </td> <td class="s"> $form_attrs->{action} = $at->{action} if $at->{action}; </td> </tr> <tr> <td class="h" > <a name="6308">6308</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 14 </td> <td class="s"> my $prompt_attr = $at->{prompt}; </td> </tr> <tr> <td class="h" > <a name="6309">6309</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 48 </td> <td class="s"> $at->{name} = {name => 'name', value => 'isindex'}; </td> </tr> <tr> <td class="h" > <a name="6310">6310</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> delete $at->{action}; </td> </tr> <tr> <td class="h" > <a name="6311">6311</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 14 </td> <td class="s"> delete $at->{prompt}; </td> </tr> <tr> <td class="h" > <a name="6312">6312</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my @tokens = ( </td> </tr> <tr> <td class="h" > <a name="6313">6313</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> {type => START_TAG_TOKEN, tag_name => 'form', </td> </tr> <tr> <td class="h" > <a name="6314">6314</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> attributes => $form_attrs, </td> </tr> <tr> <td class="h" > <a name="6315">6315</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> line => $token->{line}, column => $token->{column}}, </td> </tr> <tr> <td class="h" > <a name="6316">6316</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> {type => START_TAG_TOKEN, tag_name => 'hr', </td> </tr> <tr> <td class="h" > <a name="6317">6317</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> line => $token->{line}, column => $token->{column}}, </td> </tr> <tr> <td class="h" > <a name="6318">6318</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> {type => START_TAG_TOKEN, tag_name => 'label', </td> </tr> <tr> <td class="h" > <a name="6319">6319</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> line => $token->{line}, column => $token->{column}}, </td> </tr> <tr> <td class="h" > <a name="6320">6320</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 61 </td> <td class="s"> ); </td> </tr> <tr> <td class="h" > <a name="6321">6321</a> </td> <td class="c3" > 7 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6321-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 19 </td> <td class="s"> if ($prompt_attr) { </td> </tr> <tr> <td class="h" > <a name="6322">6322</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6323">6323</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> push @tokens, {type => CHARACTER_TOKEN, data => $prompt_attr->{value}, </td> </tr> <tr> <td class="h" > <a name="6324">6324</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #line => $token->{line}, column => $token->{column}, </td> </tr> <tr> <td class="h" > <a name="6325">6325</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> }; </td> </tr> <tr> <td class="h" > <a name="6326">6326</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6327">6327</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6328">6328</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> push @tokens, {type => CHARACTER_TOKEN, </td> </tr> <tr> <td class="h" > <a name="6329">6329</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> data => 'This is a searchable index. Enter search keywords: ', </td> </tr> <tr> <td class="h" > <a name="6330">6330</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #line => $token->{line}, column => $token->{column}, </td> </tr> <tr> <td class="h" > <a name="6331">6331</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }; # SHOULD </td> </tr> <tr> <td class="h" > <a name="6332">6332</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: make this configurable </td> </tr> <tr> <td class="h" > <a name="6333">6333</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6334">6334</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> push @tokens, </td> </tr> <tr> <td class="h" > <a name="6335">6335</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> {type => START_TAG_TOKEN, tag_name => 'input', attributes => $at, </td> </tr> <tr> <td class="h" > <a name="6336">6336</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> line => $token->{line}, column => $token->{column}}, </td> </tr> <tr> <td class="h" > <a name="6337">6337</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #{type => CHARACTER_TOKEN, data => ''}, # SHOULD </td> </tr> <tr> <td class="h" > <a name="6338">6338</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> {type => END_TAG_TOKEN, tag_name => 'label', </td> </tr> <tr> <td class="h" > <a name="6339">6339</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> line => $token->{line}, column => $token->{column}}, </td> </tr> <tr> <td class="h" > <a name="6340">6340</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> {type => START_TAG_TOKEN, tag_name => 'hr', </td> </tr> <tr> <td class="h" > <a name="6341">6341</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> line => $token->{line}, column => $token->{column}}, </td> </tr> <tr> <td class="h" > <a name="6342">6342</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> {type => END_TAG_TOKEN, tag_name => 'form', </td> </tr> <tr> <td class="h" > <a name="6343">6343</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 74 </td> <td class="s"> line => $token->{line}, column => $token->{column}}; </td> </tr> <tr> <td class="h" > <a name="6344">6344</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> unshift @{$self->{token}}, (@tokens); </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 24 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6345">6345</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 32 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6346">6346</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 46 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6347">6347</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6348">6348</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'textarea') { </td> </tr> <tr> <td class="h" > <a name="6349">6349</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 1. Insert </td> </tr> <tr> <td class="h" > <a name="6350">6350</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6351">6351</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6352">6352</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 25 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 16 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6353">6353</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6354">6354</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 133 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6355">6355</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6356">6356</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 29 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 47 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6357">6357</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6358">6358</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 16 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS (undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6359">6359</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 11 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6360">6360</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 12 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6361">6361</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6362">6362</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 16 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6363">6363</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6364">6364</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6365">6365</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6366">6366</a> </td> <td class="c3" > 10 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6366-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 57 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6367">6367</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6368">6368</a> </td> <td class="c3" > 10 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6368-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 53 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6369">6369</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6370">6370</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 41 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6371">6371</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6371-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 37 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 184 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6372">6372</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6373">6373</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6374">6374</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6375">6375</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 2 # XXX </td> </tr> <tr> <td class="h" > <a name="6376">6376</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: $self->{form_element} if defined </td> </tr> <tr> <td class="h" > <a name="6377">6377</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6378">6378</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 2. Drop U+000A LINE FEED </td> </tr> <tr> <td class="h" > <a name="6379">6379</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 24 </td> <td class="s"> $self->{ignore_newline} = 1; </td> </tr> <tr> <td class="h" > <a name="6380">6380</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6381">6381</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 3. RCDATA </td> </tr> <tr> <td class="h" > <a name="6382">6382</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 22 </td> <td class="s"> $self->{state} = RCDATA_STATE; </td> </tr> <tr> <td class="h" > <a name="6383">6383</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 23 </td> <td class="s"> delete $self->{escape}; # MUST </td> </tr> <tr> <td class="h" > <a name="6384">6384</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6385">6385</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 4., 6. Insertion mode </td> </tr> <tr> <td class="h" > <a name="6386">6386</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 20 </td> <td class="s"> $self->{insertion_mode} |= IN_CDATA_RCDATA_IM; </td> </tr> <tr> <td class="h" > <a name="6387">6387</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6388">6388</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 5. Frameset-ng. </td> </tr> <tr> <td class="h" > <a name="6389">6389</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6390">6390</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6391">6391</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6392">6392</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 34 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6393">6393</a> </td> <td class="c3" > 10 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 74 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6394">6394</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'optgroup' or </td> </tr> <tr> <td class="h" > <a name="6395">6395</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token->{tag_name} eq 'option') { </td> </tr> <tr> <td class="h" > <a name="6396">6396</a> </td> <td class="c3" > 12 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6396-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 61 </td> <td class="s"> if ($self->{open_elements}->[-1]->[1] == OPTION_EL) { </td> </tr> <tr> <td class="h" > <a name="6397">6397</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6398">6398</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: As if </option> </td> </tr> <tr> <td class="h" > <a name="6399">6399</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6400">6400</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 10 </td> <td class="s"> $token->{self_closing} = $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6401">6401</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> unshift @{$self->{token}}, $token; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 11 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6402">6402</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6403">6403</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # <option> or <optgroup> </td> </tr> <tr> <td class="h" > <a name="6404">6404</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token = {type => END_TAG_TOKEN, tag_name => 'option', </td> </tr> <tr> <td class="h" > <a name="6405">6405</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 45 </td> <td class="s"> line => $token->{line}, column => $token->{column}}; </td> </tr> <tr> <td class="h" > <a name="6406">6406</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 22 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6407">6407</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6408">6408</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6409">6409</a> </td> <td class="c3" > 9 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6409-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 29 </td> <td class="s"> my $insert = $self->{insertion_mode} & TABLE_IMS </td> </tr> <tr> <td class="h" > <a name="6410">6410</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ? $insert_to_foster : $insert_to_current; </td> </tr> <tr> <td class="h" > <a name="6411">6411</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 36 </td> <td class="s"> $reconstruct_active_formatting_elements </td> </tr> <tr> <td class="h" > <a name="6412">6412</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->($self, $insert, $active_formatting_elements, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6413">6413</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6414">6414</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6415">6415</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6416">6416</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 18 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 15 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6417">6417</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6418">6418</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 106 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6419">6419</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6420">6420</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 23 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 47 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6421">6421</a> </td> <td class="c0" > <a href="#6422"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6422">6422</a> </td> <td class="c0" > <a href="#6423"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS (undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6423">6423</a> </td> <td class="c0" > <a href="#6424"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6424">6424</a> </td> <td class="c0" > <a href="#6425"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6425">6425</a> </td> <td class="c0" > <a href="#6426"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6426">6426</a> </td> <td class="c0" > <a href="#6464"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6427">6427</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6428">6428</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6429">6429</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6430">6430</a> </td> <td class="c3" > 9 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6430-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 63 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6431">6431</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6432">6432</a> </td> <td class="c3" > 9 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6432-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 38 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6433">6433</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6434">6434</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 33 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6435">6435</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6435-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 34 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 153 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6436">6436</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6437">6437</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6438">6438</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6439">6439</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6440">6440</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 35 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6441">6441</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 53 </td> <td class="s"> redo B; </td> </tr> <tr> <td class="h" > <a name="6442">6442</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'rt' or </td> </tr> <tr> <td class="h" > <a name="6443">6443</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token->{tag_name} eq 'rp') { </td> </tr> <tr> <td class="h" > <a name="6444">6444</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## has a |ruby| element in scope </td> </tr> <tr> <td class="h" > <a name="6445">6445</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 25 </td> <td class="s"> INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 29 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6446">6446</a> </td> <td class="c3" > 20 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 37 </td> <td class="s"> my $node = $self->{open_elements}->[$_]; </td> </tr> <tr> <td class="h" > <a name="6447">6447</a> </td> <td class="c3" > 20 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6447-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 71 </td> <td class="s"> if ($node->[1] == RUBY_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6448">6448</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6449">6449</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## generate implied end tags </td> </tr> <tr> <td class="h" > <a name="6450">6450</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 29 </td> <td class="s"> while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { </td> </tr> <tr> <td class="h" > <a name="6451">6451</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6452">6452</a> </td> <td class="c3" > 4 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 4 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6453">6453</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6454">6454</a> </td> <td class="c3" > 8 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6454-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 85 </td> <td class="s"> unless ($self->{open_elements}->[-1]->[1] == RUBY_EL) { </td> </tr> <tr> <td class="h" > <a name="6455">6455</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6456">6456</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', </td> </tr> <tr> <td class="h" > <a name="6457">6457</a> </td> <td class="c3" > 6 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 54 </td> <td class="s"> text => $self->{open_elements}->[-1]->[0] </td> </tr> <tr> <td class="h" > <a name="6458">6458</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->tagName, </td> </tr> <tr> <td class="h" > <a name="6459">6459</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> token => $token); </td> </tr> <tr> <td class="h" > <a name="6460">6460</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6461">6461</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 19 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6462">6462</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[1] & SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6463">6463</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6464">6464</a> </td> <td class="c0" > <a href="#6475"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6465">6465</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6466">6466</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6467">6467</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6468">6468</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6469">6469</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6470">6470</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 13 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6471">6471</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6472">6472</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 62 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6473">6473</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6474">6474</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 19 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 32 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6475">6475</a> </td> <td class="c0" > <a href="#6476"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6476">6476</a> </td> <td class="c0" > <a href="#6477"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS(undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6477">6477</a> </td> <td class="c0" > <a href="#6478"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6478">6478</a> </td> <td class="c0" > <a href="#6479"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6479">6479</a> </td> <td class="c0" > <a href="#6480"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6480">6480</a> </td> <td class="c0" > <a href="#6528"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6481">6481</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6482">6482</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6483">6483</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6484">6484</a> </td> <td class="c3" > 8 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6484-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 43 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6485">6485</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6486">6486</a> </td> <td class="c3" > 8 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6486-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 36 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6487">6487</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6488">6488</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6489">6489</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6489-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 24 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 128 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6490">6490</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6491">6491</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6492">6492</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6493">6493</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6494">6494</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 30 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6495">6495</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 57 </td> <td class="s"> redo B; </td> </tr> <tr> <td class="h" > <a name="6496">6496</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'math' or </td> </tr> <tr> <td class="h" > <a name="6497">6497</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token->{tag_name} eq 'svg') { </td> </tr> <tr> <td class="h" > <a name="6498">6498</a> </td> <td class="c3" > 106 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6498-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 408 </td> <td class="s"> my $insert = $self->{insertion_mode} & TABLE_IMS </td> </tr> <tr> <td class="h" > <a name="6499">6499</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ? $insert_to_foster : $insert_to_current; </td> </tr> <tr> <td class="h" > <a name="6500">6500</a> </td> <td class="c3" > 106 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 403 </td> <td class="s"> $reconstruct_active_formatting_elements </td> </tr> <tr> <td class="h" > <a name="6501">6501</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->($self, $insert, $active_formatting_elements, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6502">6502</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6503">6503</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "Adjust MathML attributes" ('math' only) - done in insert-element-f </td> </tr> <tr> <td class="h" > <a name="6504">6504</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6505">6505</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "adjust SVG attributes" ('svg' only) - done in insert-element-f </td> </tr> <tr> <td class="h" > <a name="6506">6506</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6507">6507</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "adjust foreign attributes" - done in insert-element-f </td> </tr> <tr> <td class="h" > <a name="6508">6508</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6509">6509</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6510">6510</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6511">6511</a> </td> <td class="c3" > 106 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 193 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 106 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 180 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6512">6512</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6513">6513</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $el = $self->{document}->createElementNS </td> </tr> <tr> <td class="h" > <a name="6514">6514</a> </td> <td class="c3" > 106 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6514-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 1140 </td> <td class="s"> ($token->{tag_name} eq 'math' ? (MML_NS) : (SVG_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6515">6515</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6516">6516</a> </td> <td class="c3" > 106 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 306 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 106 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 524 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6517">6517</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6518">6518</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> my $attr; </td> </tr> <tr> <td class="h" > <a name="6519">6519</a> </td> <td class="c3" > 1 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6519-1"> 50 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6519-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> if (defined $foreign_attr_xname->{ $attr_name }) </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-4"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6520">6520</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6521">6521</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> my $xmlnsuri = $foreign_attr_xname->{ $attr_name }->[0]; </td> </tr> <tr> <td class="h" > <a name="6522">6522</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> my $qname = join ':', @{$foreign_attr_xname->{ $attr_name }->[1]}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6523">6523</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 12 </td> <td class="s"> $qname =~ s/(^:)|(:$)//; </td> </tr> <tr> <td class="h" > <a name="6524">6524</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 15 </td> <td class="s"> $attr = $self->{document}->createAttributeNS($xmlnsuri, $qname); </td> </tr> <tr> <td class="h" > <a name="6525">6525</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6526">6526</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> elsif ($token->{tag_name} eq 'math' && $attr_name eq 'definitionurl') </td> </tr> <tr> <td class="h" > <a name="6527">6527</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6528">6528</a> </td> <td class="c0" > <a href="#6532"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $attr = $self->{document}->createAttributeNS((MML_NS), 'definitionURL'); </td> </tr> <tr> <td class="h" > <a name="6529">6529</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6530">6530</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> elsif ($token->{tag_name} eq 'math') </td> </tr> <tr> <td class="h" > <a name="6531">6531</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6532">6532</a> </td> <td class="c0" > <a href="#6537"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $attr = $self->{document}->createAttributeNS((MML_NS), $attr_name); </td> </tr> <tr> <td class="h" > <a name="6533">6533</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6534">6534</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> elsif ($token->{tag_name} eq 'svg') </td> </tr> <tr> <td class="h" > <a name="6535">6535</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6536">6536</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $attr = $self->{document}->createAttributeNS( </td> </tr> <tr> <td class="h" > <a name="6537">6537</a> </td> <td class="c0" > <a href="#6541"> 0 </a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6537-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> (SVG_NS), ($svg_attr_name->{$attr_name} || $attr_name)); </td> </tr> <tr> <td class="h" > <a name="6538">6538</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6539">6539</a> </td> <td class="c3" > 1 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6539-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> unless ($attr) </td> </tr> <tr> <td class="h" > <a name="6540">6540</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6541">6541</a> </td> <td class="c0" > <a href="#6561"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $attr = $self->{document}->createAttribute($attr_name); </td> </tr> <tr> <td class="h" > <a name="6542">6542</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6543">6543</a> </td> <td class="c3" > 1 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6543-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 13 </td> <td class="s"> if ($attr) </td> </tr> <tr> <td class="h" > <a name="6544">6544</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6545">6545</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 141 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6546">6546</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6547">6547</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6548">6548</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6549">6549</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6550">6550</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6551">6551</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6552">6552</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6553">6553</a> </td> <td class="c3" > 106 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6553-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 559 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6554">6554</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6555">6555</a> </td> <td class="c3" > 106 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6555-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 439 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6556">6556</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6557">6557</a> </td> <td class="c3" > 106 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 368 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6558">6558</a> </td> <td class="c3" > 106 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6558-1"> 100 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6558-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 467 </td> <td class="s"> push @{$self->{open_elements}}, [$el, ($el_category_f->{$token->{tag_name} eq 'math' ? MML_NS : SVG_NS}->{ $token->{tag_name}} || 0) | FOREIGN_EL | (($token->{tag_name} eq 'math' ? MML_NS : SVG_NS) eq SVG_NS ? SVG_EL : ($token->{tag_name} eq 'math' ? MML_NS : SVG_NS) eq MML_NS ? MML_EL : 0)]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 106 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 2460 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-4"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6559">6559</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6560">6560</a> </td> <td class="c3" > 106 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6560-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6560-1"> 33 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 398 </td> <td class="s"> if ( $token->{attributes}->{xmlns} and $token->{attributes}->{xmlns}->{value} ne ($token->{tag_name} eq 'math' ? (MML_NS) : (SVG_NS))) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6561">6561</a> </td> <td class="c0" > <a href="#6566"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'bad namespace', token => $token); </td> </tr> <tr> <td class="h" > <a name="6562">6562</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: Error type documentation </td> </tr> <tr> <td class="h" > <a name="6563">6563</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6564">6564</a> </td> <td class="c3" > 106 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6564-1"> 50 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6564-1"> 33 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 344 </td> <td class="s"> if ( $token->{attributes}->{'xmlns:xlink'} and </td> </tr> <tr> <td class="h" > <a name="6565">6565</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token->{attributes}->{'xmlns:xlink'}->{value} ne q<http://www.w3.org/1999/xlink>) { </td> </tr> <tr> <td class="h" > <a name="6566">6566</a> </td> <td class="c0" > <a href="#6603"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'bad namespace', token => $token); </td> </tr> <tr> <td class="h" > <a name="6567">6567</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6568">6568</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6569">6569</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6570">6570</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6571">6571</a> </td> <td class="c3" > 106 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6571-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 253 </td> <td class="s"> if ($self->{self_closing}) { </td> </tr> <tr> <td class="h" > <a name="6572">6572</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6573">6573</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6574">6574</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6575">6575</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6576">6576</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6577">6577</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6578">6578</a> </td> <td class="c3" > 106 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 427 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6579">6579</a> </td> <td class="c3" > 106 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 671 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6580">6580</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ({ </td> </tr> <tr> <td class="h" > <a name="6581">6581</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> caption => 1, col => 1, colgroup => 1, frame => 1, </td> </tr> <tr> <td class="h" > <a name="6582">6582</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> head => 1, </td> </tr> <tr> <td class="h" > <a name="6583">6583</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> tbody => 1, td => 1, tfoot => 1, th => 1, </td> </tr> <tr> <td class="h" > <a name="6584">6584</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> thead => 1, tr => 1, </td> </tr> <tr> <td class="h" > <a name="6585">6585</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$token->{tag_name}}) { </td> </tr> <tr> <td class="h" > <a name="6586">6586</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6587">6587</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'in body', </td> </tr> <tr> <td class="h" > <a name="6588">6588</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 66 </td> <td class="s"> text => $token->{tag_name}, token => $token); </td> </tr> <tr> <td class="h" > <a name="6589">6589</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Ignore the token </td> </tr> <tr> <td class="h" > <a name="6590">6590</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: |<col/>| or |<frame/>| here is an error. </td> </tr> <tr> <td class="h" > <a name="6591">6591</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 33 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6592">6592</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 66 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6593">6593</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'param' or </td> </tr> <tr> <td class="h" > <a name="6594">6594</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token->{tag_name} eq 'source' or </td> </tr> <tr> <td class="h" > <a name="6595">6595</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token->{tag_name} eq 'track') { </td> </tr> <tr> <td class="h" > <a name="6596">6596</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6597">6597</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6598">6598</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6599">6599</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6600">6600</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 40 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6601">6601</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6602">6602</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 16 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6603">6603</a> </td> <td class="c0" > <a href="#6604"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6604">6604</a> </td> <td class="c0" > <a href="#6605"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS(undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6605">6605</a> </td> <td class="c0" > <a href="#6606"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $attr->setValue($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6606">6606</a> </td> <td class="c0" > <a href="#6607"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6607">6607</a> </td> <td class="c0" > <a href="#6608"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6608">6608</a> </td> <td class="c0" > <a href="#6827"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6609">6609</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6610">6610</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6611">6611</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6612">6612</a> </td> <td class="c3" > 3 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6612-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 19 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6613">6613</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6614">6614</a> </td> <td class="c3" > 3 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6614-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6615">6615</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6616">6616</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 11 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6617">6617</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6617-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 13 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 52 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6618">6618</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6619">6619</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6620">6620</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6621">6621</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6622">6622</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6623">6623</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 38 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6624">6624</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 22 </td> <td class="s"> redo B; </td> </tr> <tr> <td class="h" > <a name="6625">6625</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6626">6626</a> </td> <td class="c3" > 246 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6626-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 765 </td> <td class="s"> if ($token->{tag_name} eq 'image') { </td> </tr> <tr> <td class="h" > <a name="6627">6627</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6628">6628</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'image', token => $token); </td> </tr> <tr> <td class="h" > <a name="6629">6629</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> $token->{tag_name} = 'img'; </td> </tr> <tr> <td class="h" > <a name="6630">6630</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6631">6631</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6632">6632</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6633">6633</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6634">6634</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: There is an "as if <br>" code clone. </td> </tr> <tr> <td class="h" > <a name="6635">6635</a> </td> <td class="c3" > 246 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6635-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 740 </td> <td class="s"> my $insert = $self->{insertion_mode} & TABLE_IMS </td> </tr> <tr> <td class="h" > <a name="6636">6636</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ? $insert_to_foster : $insert_to_current; </td> </tr> <tr> <td class="h" > <a name="6637">6637</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 814 </td> <td class="s"> $reconstruct_active_formatting_elements </td> </tr> <tr> <td class="h" > <a name="6638">6638</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->($self, $insert, $active_formatting_elements, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6639">6639</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6640">6640</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6641">6641</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="6642">6642</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 646 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 413 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6643">6643</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 947 </td> <td class="s"> $token->{tag_name} =~ s/[^A-Za-z0-9:_-]//g; </td> </tr> <tr> <td class="h" > <a name="6644">6644</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 2186 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), $token->{tag_name}); </td> </tr> <tr> <td class="h" > <a name="6645">6645</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6646">6646</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 583 </td> <td class="s"> ATR: for my $attr_name (keys %{ $token->{attributes}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 1193 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6647">6647</a> </td> <td class="c3" > 35 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 87 </td> <td class="s"> my $attr_t = $token->{attributes}->{$attr_name}; </td> </tr> <tr> <td class="h" > <a name="6648">6648</a> </td> <td class="c3" > 35 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 255 </td> <td class="s"> my $attr = $self->{document}->createAttributeNS (undef, $attr_name); </td> </tr> <tr> <td class="h" > <a name="6649">6649</a> </td> <td class="c3" > 35 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6649-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 111 </td> <td class="s"> next ATR unless ref($attr); </td> </tr> <tr> <td class="h" > <a name="6650">6650</a> </td> <td class="c3" > 32 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 177 </td> <td class="s"> $attr->setValue ($attr_t->{value}); </td> </tr> <tr> <td class="h" > <a name="6651">6651</a> </td> <td class="c3" > 32 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 143 </td> <td class="s"> $self->_data($attr, manakai_source_line => $attr_t->{line}); </td> </tr> <tr> <td class="h" > <a name="6652">6652</a> </td> <td class="c3" > 32 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 154 </td> <td class="s"> $self->_data($attr, manakai_source_column => $attr_t->{column}); </td> </tr> <tr> <td class="h" > <a name="6653">6653</a> </td> <td class="c3" > 32 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 271 </td> <td class="s"> $el->setAttributeNodeNS ($attr); </td> </tr> <tr> <td class="h" > <a name="6654">6654</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6655">6655</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6656">6656</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="6657">6657</a> </td> <td class="c3" > 246 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6657-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 1258 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="6658">6658</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="6659">6659</a> </td> <td class="c3" > 246 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6659-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 1107 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="6660">6660</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6661">6661</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 837 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="6662">6662</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6662-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 1091 </td> <td class="s"> push @{$self->{open_elements}}, [$el, $el_category->{$token->{tag_name}} || 0]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3889 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6663">6663</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6664">6664</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6665">6665</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6666">6666</a> </td> <td class="c3" > 246 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6666-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4203 </td> <td class="s"> if ({ </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-4"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-5"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6667">6667</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> applet => 1, marquee => 1, object => 1, </td> </tr> <tr> <td class="h" > <a name="6668">6668</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$token->{tag_name}}) { </td> </tr> <tr> <td class="h" > <a name="6669">6669</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6670">6670</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6671">6671</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 25 </td> <td class="s"> push @$active_formatting_elements, ['#marker', '', undef]; </td> </tr> <tr> <td class="h" > <a name="6672">6672</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6673">6673</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 20 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6674">6674</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6675">6675</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6676">6676</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ({ </td> </tr> <tr> <td class="h" > <a name="6677">6677</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> b => 1, big => 1, code=>1, em => 1, font => 1, i => 1, </td> </tr> <tr> <td class="h" > <a name="6678">6678</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> s => 1, small => 1, strike => 1, </td> </tr> <tr> <td class="h" > <a name="6679">6679</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> strong => 1, tt => 1, u => 1, </td> </tr> <tr> <td class="h" > <a name="6680">6680</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$token->{tag_name}}) { </td> </tr> <tr> <td class="h" > <a name="6681">6681</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6682">6682</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> push @$active_formatting_elements, </td> </tr> <tr> <td class="h" > <a name="6683">6683</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> [$self->{open_elements}->[-1]->[0], </td> </tr> <tr> <td class="h" > <a name="6684">6684</a> </td> <td class="c3" > 99 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 385 </td> <td class="s"> $self->{open_elements}->[-1]->[1], </td> </tr> <tr> <td class="h" > <a name="6685">6685</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $token]; </td> </tr> <tr> <td class="h" > <a name="6686">6686</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6687">6687</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'input') { </td> </tr> <tr> <td class="h" > <a name="6688">6688</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6689">6689</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: associate with $self->{form_element} if defined </td> </tr> <tr> <td class="h" > <a name="6690">6690</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6691">6691</a> </td> <td class="c3" > 17 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 37 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 17 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 47 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6692">6692</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6693">6693</a> </td> <td class="c3" > 17 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6693-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 67 </td> <td class="s"> if ($token->{attributes}->{type}) { </td> </tr> <tr> <td class="h" > <a name="6694">6694</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 102 </td> <td class="s"> my $type = $token->{attributes}->{type}->{value}; </td> </tr> <tr> <td class="h" > <a name="6695">6695</a> </td> <td class="c3" > 5 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 27 </td> <td class="s"> $type =~ tr/A-Z/a-z/; ## ASCII case-insensitive. </td> </tr> <tr> <td class="h" > <a name="6696">6696</a> </td> <td class="c3" > 5 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6696-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 19 </td> <td class="s"> if ($type eq 'hidden') { </td> </tr> <tr> <td class="h" > <a name="6697">6697</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # </td> </tr> <tr> <td class="h" > <a name="6698">6698</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6699">6699</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6700">6700</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6701">6701</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6702">6702</a> </td> <td class="c3" > 12 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 170 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6703">6703</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6704">6704</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6705">6705</a> </td> <td class="c3" > 17 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 39 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6706">6706</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ({ </td> </tr> <tr> <td class="h" > <a name="6707">6707</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> area => 1, br => 1, embed => 1, img => 1, wbr => 1, keygen => 1, </td> </tr> <tr> <td class="h" > <a name="6708">6708</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$token->{tag_name}}) { </td> </tr> <tr> <td class="h" > <a name="6709">6709</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6710">6710</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6711">6711</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 61 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 68 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6712">6712</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6713">6713</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 85 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6714">6714</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6715">6715</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 331 </td> <td class="s"> delete $self->{self_closing}; </td> </tr> <tr> <td class="h" > <a name="6716">6716</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'select') { </td> </tr> <tr> <td class="h" > <a name="6717">6717</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: associate with $self->{form_element} if defined </td> </tr> <tr> <td class="h" > <a name="6718">6718</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6719">6719</a> </td> <td class="c3" > 42 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 108 </td> <td class="s"> delete $self->{frameset_ok}; </td> </tr> <tr> <td class="h" > <a name="6720">6720</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6721">6721</a> </td> <td class="c3" > 42 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6721-1"> 100 </a> </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6721-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 222 </td> <td class="s"> if ($self->{insertion_mode} & TABLE_IMS or </td> </tr> <tr> <td class="h" > <a name="6722">6722</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{insertion_mode} & BODY_TABLE_IMS) { </td> </tr> <tr> <td class="h" > <a name="6723">6723</a> </td> <td class="c3" > 16 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 55 </td> <td class="s"> $self->{insertion_mode} = IN_SELECT_IN_TABLE_IM; </td> </tr> <tr> <td class="h" > <a name="6724">6724</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6725">6725</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6726">6726</a> </td> <td class="c3" > 26 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 62 </td> <td class="s"> $self->{insertion_mode} = IN_SELECT_IM; </td> </tr> <tr> <td class="h" > <a name="6727">6727</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6728">6728</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6729">6729</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6730">6730</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6731">6731</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6732">6732</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6733">6733</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 1386 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6734">6734</a> </td> <td class="c3" > 246 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 1743 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6735">6735</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6736">6736</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{type} == END_TAG_TOKEN) { </td> </tr> <tr> <td class="h" > <a name="6737">6737</a> </td> <td class="c3" > 372 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6737-1"> 100 </a> </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6737-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7527 </td> <td class="s"> if ($token->{tag_name} eq 'body' or $token->{tag_name} eq 'html') { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-4"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-5"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-6"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-7"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6738">6738</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6739">6739</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 1. If not "have an element in scope": </td> </tr> <tr> <td class="h" > <a name="6740">6740</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "has a |body| element in scope" </td> </tr> <tr> <td class="h" > <a name="6741">6741</a> </td> <td class="c3" > 53 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 146 </td> <td class="s"> my $i; </td> </tr> <tr> <td class="h" > <a name="6742">6742</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> INSCOPE: { </td> </tr> <tr> <td class="h" > <a name="6743">6743</a> </td> <td class="c3" > 53 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 106 </td> <td class="s"> for (reverse @{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 53 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 99 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 53 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 194 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6744">6744</a> </td> <td class="c3" > 62 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6744-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 182 </td> <td class="s"> if ($_->[1] == BODY_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6745">6745</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6746">6746</a> </td> <td class="c3" > 52 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 84 </td> <td class="s"> $i = $_; </td> </tr> <tr> <td class="h" > <a name="6747">6747</a> </td> <td class="c3" > 52 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 126 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6748">6748</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($_->[1] & SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6749">6749</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6750">6750</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> last; </td> </tr> <tr> <td class="h" > <a name="6751">6751</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6752">6752</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6753">6753</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6754">6754</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: |<marquee></body>|, |<svg><foreignobject></body>|, </td> </tr> <tr> <td class="h" > <a name="6755">6755</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## and fragment cases. </td> </tr> <tr> <td class="h" > <a name="6756">6756</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6757">6757</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', </td> </tr> <tr> <td class="h" > <a name="6758">6758</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> text => $token->{tag_name}, token => $token); </td> </tr> <tr> <td class="h" > <a name="6759">6759</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Ignore the token. (</body> or </html>) </td> </tr> <tr> <td class="h" > <a name="6760">6760</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6761">6761</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6762">6762</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6763">6763</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6764">6764</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 2. If unclosed elements: </td> </tr> <tr> <td class="h" > <a name="6765">6765</a> </td> <td class="c3" > 52 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 98 </td> <td class="s"> for (@{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 52 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 136 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6766">6766</a> </td> <td class="c3" > 112 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6766-1"> 100 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6766-1"> 66 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 419 </td> <td class="s"> unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL || </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#-2"> 66 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#-3"> 33 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6767">6767</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $_->[1] == OPTGROUP_EL || </td> </tr> <tr> <td class="h" > <a name="6768">6768</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $_->[1] == OPTION_EL || </td> </tr> <tr> <td class="h" > <a name="6769">6769</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $_->[1] == RUBY_COMPONENT_EL) { </td> </tr> <tr> <td class="h" > <a name="6770">6770</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6771">6771</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 61 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', </td> </tr> <tr> <td class="h" > <a name="6772">6772</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> text => $_->[0]->tagName, </td> </tr> <tr> <td class="h" > <a name="6773">6773</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> token => $token); </td> </tr> <tr> <td class="h" > <a name="6774">6774</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 18 </td> <td class="s"> last; </td> </tr> <tr> <td class="h" > <a name="6775">6775</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6776">6776</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6777">6777</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6778">6778</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6779">6779</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6780">6780</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 3. Switch the insertion mode. </td> </tr> <tr> <td class="h" > <a name="6781">6781</a> </td> <td class="c3" > 52 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 114 </td> <td class="s"> $self->{insertion_mode} = AFTER_BODY_IM; </td> </tr> <tr> <td class="h" > <a name="6782">6782</a> </td> <td class="c3" > 52 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6782-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 150 </td> <td class="s"> if ($token->{tag_name} eq 'body') { </td> </tr> <tr> <td class="h" > <a name="6783">6783</a> </td> <td class="c3" > 35 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 121 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6784">6784</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { # html </td> </tr> <tr> <td class="h" > <a name="6785">6785</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Reprocess. </td> </tr> <tr> <td class="h" > <a name="6786">6786</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6787">6787</a> </td> <td class="c3" > 52 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 121 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6788">6788</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ({ </td> </tr> <tr> <td class="h" > <a name="6789">6789</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "In body" insertion mode, end tags for non-phrasing flow </td> </tr> <tr> <td class="h" > <a name="6790">6790</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## content elements. </td> </tr> <tr> <td class="h" > <a name="6791">6791</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6792">6792</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> address => 1, article => 1, aside => 1, blockquote => 1, </td> </tr> <tr> <td class="h" > <a name="6793">6793</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> center => 1, </td> </tr> <tr> <td class="h" > <a name="6794">6794</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #datagrid => 1, </td> </tr> <tr> <td class="h" > <a name="6795">6795</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> details => 1, </td> </tr> <tr> <td class="h" > <a name="6796">6796</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> dir => 1, div => 1, dl => 1, fieldset => 1, figure => 1, </td> </tr> <tr> <td class="h" > <a name="6797">6797</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> footer => 1, header => 1, hgroup => 1, </td> </tr> <tr> <td class="h" > <a name="6798">6798</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> listing => 1, menu => 1, nav => 1, </td> </tr> <tr> <td class="h" > <a name="6799">6799</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ol => 1, pre => 1, section => 1, ul => 1, </td> </tr> <tr> <td class="h" > <a name="6800">6800</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> figcaption => 1, summary => 1, </td> </tr> <tr> <td class="h" > <a name="6801">6801</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6802">6802</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: As normal, but ... optional tags </td> </tr> <tr> <td class="h" > <a name="6803">6803</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> dd => 1, dt => 1, li => 1, </td> </tr> <tr> <td class="h" > <a name="6804">6804</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6805">6805</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> applet => 1, button => 1, marquee => 1, object => 1, </td> </tr> <tr> <td class="h" > <a name="6806">6806</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$token->{tag_name}}) { </td> </tr> <tr> <td class="h" > <a name="6807">6807</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: Code for <li> start tags includes "as if </li>" code. </td> </tr> <tr> <td class="h" > <a name="6808">6808</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Code for <dt> or <dd> start tags includes "as if </dt> or </td> </tr> <tr> <td class="h" > <a name="6809">6809</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## </dd>" code. </td> </tr> <tr> <td class="h" > <a name="6810">6810</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6811">6811</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## has an element in scope </td> </tr> <tr> <td class="h" > <a name="6812">6812</a> </td> <td class="c3" > 67 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 185 </td> <td class="s"> my $i; </td> </tr> <tr> <td class="h" > <a name="6813">6813</a> </td> <td class="c3" > 67 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 155 </td> <td class="s"> INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 67 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 245 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6814">6814</a> </td> <td class="c3" > 85 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 177 </td> <td class="s"> my $node = $self->{open_elements}->[$_]; </td> </tr> <tr> <td class="h" > <a name="6815">6815</a> </td> <td class="c3" > 85 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6815-1"> 100 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6815-1"> 66 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 567 </td> <td class="s"> if ($node->[0]->tagName eq $token->{tag_name}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6816">6816</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6817">6817</a> </td> <td class="c3" > 65 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 134 </td> <td class="s"> $i = $_; </td> </tr> <tr> <td class="h" > <a name="6818">6818</a> </td> <td class="c3" > 65 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 139 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6819">6819</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[1] & SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6820">6820</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6821">6821</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6822">6822</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6823">6823</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> elsif ($token->{tag_name} eq 'li' and </td> </tr> <tr> <td class="h" > <a name="6824">6824</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> {ul => 1, ol => 1}->{$node->[0]->localname}) { </td> </tr> <tr> <td class="h" > <a name="6825">6825</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Has an element in list item scope </td> </tr> <tr> <td class="h" > <a name="6826">6826</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6827">6827</a> </td> <td class="c0" > <a href="#6904"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6828">6828</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6829">6829</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6830">6830</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6831">6831</a> </td> <td class="c3" > 67 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6831-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 218 </td> <td class="s"> unless (defined $i) { # has an element in scope </td> </tr> <tr> <td class="h" > <a name="6832">6832</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6833">6833</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', </td> </tr> <tr> <td class="h" > <a name="6834">6834</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> text => $token->{tag_name}, token => $token); </td> </tr> <tr> <td class="h" > <a name="6835">6835</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: Ignore the token. </td> </tr> <tr> <td class="h" > <a name="6836">6836</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6837">6837</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 1. generate implied end tags </td> </tr> <tr> <td class="h" > <a name="6838">6838</a> </td> <td class="c3" > 65 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 646 </td> <td class="s"> while ({ </td> </tr> <tr> <td class="h" > <a name="6839">6839</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## END_TAG_OPTIONAL_EL </td> </tr> <tr> <td class="h" > <a name="6840">6840</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> dd => ($token->{tag_name} ne 'dd'), </td> </tr> <tr> <td class="h" > <a name="6841">6841</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> dt => ($token->{tag_name} ne 'dt'), </td> </tr> <tr> <td class="h" > <a name="6842">6842</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> li => ($token->{tag_name} ne 'li'), </td> </tr> <tr> <td class="h" > <a name="6843">6843</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> option => 1, </td> </tr> <tr> <td class="h" > <a name="6844">6844</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> optgroup => 1, </td> </tr> <tr> <td class="h" > <a name="6845">6845</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> p => 1, </td> </tr> <tr> <td class="h" > <a name="6846">6846</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> rt => 1, </td> </tr> <tr> <td class="h" > <a name="6847">6847</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> rp => 1, </td> </tr> <tr> <td class="h" > <a name="6848">6848</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$self->{open_elements}->[-1]->[0]->tagName}) { </td> </tr> <tr> <td class="h" > <a name="6849">6849</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6850">6850</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 10 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6851">6851</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6852">6852</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6853">6853</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 2. </td> </tr> <tr> <td class="h" > <a name="6854">6854</a> </td> <td class="c3" > 65 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6854-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 460 </td> <td class="s"> if ($self->{open_elements}->[-1]->[0]->tagName </td> </tr> <tr> <td class="h" > <a name="6855">6855</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ne $token->{tag_name}) { </td> </tr> <tr> <td class="h" > <a name="6856">6856</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6857">6857</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', </td> </tr> <tr> <td class="h" > <a name="6858">6858</a> </td> <td class="c3" > 12 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 67 </td> <td class="s"> text => $self->{open_elements}->[-1]->[0] </td> </tr> <tr> <td class="h" > <a name="6859">6859</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->tagName, </td> </tr> <tr> <td class="h" > <a name="6860">6860</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> token => $token); </td> </tr> <tr> <td class="h" > <a name="6861">6861</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6862">6862</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6863">6863</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6864">6864</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6865">6865</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 3. </td> </tr> <tr> <td class="h" > <a name="6866">6866</a> </td> <td class="c3" > 65 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 123 </td> <td class="s"> splice @{$self->{open_elements}}, $i; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 65 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 175 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6867">6867</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6868">6868</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 4. </td> </tr> <tr> <td class="h" > <a name="6869">6869</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $clear_up_to_marker->($active_formatting_elements) </td> </tr> <tr> <td class="h" > <a name="6870">6870</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> if { </td> </tr> <tr> <td class="h" > <a name="6871">6871</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> applet => 1, marquee => 1, object => 1, </td> </tr> <tr> <td class="h" > <a name="6872">6872</a> </td> <td class="c3" > 65 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6872-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 426 </td> <td class="s"> }->{$token->{tag_name}}; </td> </tr> <tr> <td class="h" > <a name="6873">6873</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6874">6874</a> </td> <td class="c3" > 67 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 1125 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6875">6875</a> </td> <td class="c3" > 67 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 339 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6876">6876</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'form') { </td> </tr> <tr> <td class="h" > <a name="6877">6877</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: As normal, but interacts with the form element pointer </td> </tr> <tr> <td class="h" > <a name="6878">6878</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6879">6879</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 30 </td> <td class="s"> undef $self->{form_element}; </td> </tr> <tr> <td class="h" > <a name="6880">6880</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6881">6881</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## has an element in scope </td> </tr> <tr> <td class="h" > <a name="6882">6882</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 33 </td> <td class="s"> my $i; </td> </tr> <tr> <td class="h" > <a name="6883">6883</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 30 </td> <td class="s"> INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 32 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6884">6884</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 24 </td> <td class="s"> my $node = $self->{open_elements}->[$_]; </td> </tr> <tr> <td class="h" > <a name="6885">6885</a> </td> <td class="c3" > 9 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6885-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 29 </td> <td class="s"> if ($node->[1] == FORM_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6886">6886</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6887">6887</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> $i = $_; </td> </tr> <tr> <td class="h" > <a name="6888">6888</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6889">6889</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[1] & SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6890">6890</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6891">6891</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6892">6892</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6893">6893</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6894">6894</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6895">6895</a> </td> <td class="c3" > 9 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6895-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 24 </td> <td class="s"> unless (defined $i) { # has an element in scope </td> </tr> <tr> <td class="h" > <a name="6896">6896</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6897">6897</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', </td> </tr> <tr> <td class="h" > <a name="6898">6898</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> text => $token->{tag_name}, token => $token); </td> </tr> <tr> <td class="h" > <a name="6899">6899</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: Ignore the token. </td> </tr> <tr> <td class="h" > <a name="6900">6900</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6901">6901</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 1. generate implied end tags </td> </tr> <tr> <td class="h" > <a name="6902">6902</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 35 </td> <td class="s"> while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { </td> </tr> <tr> <td class="h" > <a name="6903">6903</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6904">6904</a> </td> <td class="c0" > <a href="#&nbsp;"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c0" > <a href="#6912"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6905">6905</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6906">6906</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6907">6907</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 2. </td> </tr> <tr> <td class="h" > <a name="6908">6908</a> </td> <td class="c3" > 8 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6908-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 58 </td> <td class="s"> if ($self->{open_elements}->[-1]->[0]->tagName </td> </tr> <tr> <td class="h" > <a name="6909">6909</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ne $token->{tag_name}) { </td> </tr> <tr> <td class="h" > <a name="6910">6910</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6911">6911</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', </td> </tr> <tr> <td class="h" > <a name="6912">6912</a> </td> <td class="c0" > <a href="#7104"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> text => $self->{open_elements}->[-1]->[0] </td> </tr> <tr> <td class="h" > <a name="6913">6913</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->tagName, </td> </tr> <tr> <td class="h" > <a name="6914">6914</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> token => $token); </td> </tr> <tr> <td class="h" > <a name="6915">6915</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6916">6916</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6917">6917</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6918">6918</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6919">6919</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 3. </td> </tr> <tr> <td class="h" > <a name="6920">6920</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> splice @{$self->{open_elements}}, $i; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 8 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 22 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6921">6921</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6922">6922</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6923">6923</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 41 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6924">6924</a> </td> <td class="c3" > 9 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 42 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6925">6925</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ({ </td> </tr> <tr> <td class="h" > <a name="6926">6926</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: As normal, except acts as a closer for any ... </td> </tr> <tr> <td class="h" > <a name="6927">6927</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, </td> </tr> <tr> <td class="h" > <a name="6928">6928</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$token->{tag_name}}) { </td> </tr> <tr> <td class="h" > <a name="6929">6929</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## has an element in scope </td> </tr> <tr> <td class="h" > <a name="6930">6930</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> my $i; </td> </tr> <tr> <td class="h" > <a name="6931">6931</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6932">6932</a> </td> <td class="c3" > 7 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 15 </td> <td class="s"> my $node = $self->{open_elements}->[$_]; </td> </tr> <tr> <td class="h" > <a name="6933">6933</a> </td> <td class="c3" > 7 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6933-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> if ($node->[1] == HEADING_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6934">6934</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6935">6935</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> $i = $_; </td> </tr> <tr> <td class="h" > <a name="6936">6936</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6937">6937</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[1] & SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6938">6938</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6939">6939</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6940">6940</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6941">6941</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6942">6942</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6943">6943</a> </td> <td class="c3" > 3 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6943-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 10 </td> <td class="s"> unless (defined $i) { # has an element in scope </td> </tr> <tr> <td class="h" > <a name="6944">6944</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6945">6945</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', </td> </tr> <tr> <td class="h" > <a name="6946">6946</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 6 </td> <td class="s"> text => $token->{tag_name}, token => $token); </td> </tr> <tr> <td class="h" > <a name="6947">6947</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: Ignore the token. </td> </tr> <tr> <td class="h" > <a name="6948">6948</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6949">6949</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 1. generate implied end tags </td> </tr> <tr> <td class="h" > <a name="6950">6950</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { </td> </tr> <tr> <td class="h" > <a name="6951">6951</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6952">6952</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6953">6953</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6954">6954</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6955">6955</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 2. </td> </tr> <tr> <td class="h" > <a name="6956">6956</a> </td> <td class="c3" > 2 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6956-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 29 </td> <td class="s"> if ($self->{open_elements}->[-1]->[0]->tagName </td> </tr> <tr> <td class="h" > <a name="6957">6957</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ne $token->{tag_name}) { </td> </tr> <tr> <td class="h" > <a name="6958">6958</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6959">6959</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', </td> </tr> <tr> <td class="h" > <a name="6960">6960</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> text => $token->{tag_name}, token => $token); </td> </tr> <tr> <td class="h" > <a name="6961">6961</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6962">6962</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6963">6963</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6964">6964</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6965">6965</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 3. </td> </tr> <tr> <td class="h" > <a name="6966">6966</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> splice @{$self->{open_elements}}, $i; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 2 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6967">6967</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6968">6968</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6969">6969</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="6970">6970</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 19 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="6971">6971</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'p') { </td> </tr> <tr> <td class="h" > <a name="6972">6972</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "In body" insertion mode, "p" start tag. As normal, except </td> </tr> <tr> <td class="h" > <a name="6973">6973</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## </p> implies <p> and ... </td> </tr> <tr> <td class="h" > <a name="6974">6974</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6975">6975</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "have an element in button scope". </td> </tr> <tr> <td class="h" > <a name="6976">6976</a> </td> <td class="c3" > 61 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 193 </td> <td class="s"> my $non_optional; </td> </tr> <tr> <td class="h" > <a name="6977">6977</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $i; </td> </tr> <tr> <td class="h" > <a name="6978">6978</a> </td> <td class="c3" > 61 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 141 </td> <td class="s"> INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 61 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 235 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6979">6979</a> </td> <td class="c3" > 86 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 219 </td> <td class="s"> my $node = $self->{open_elements}->[$_]; </td> </tr> <tr> <td class="h" > <a name="6980">6980</a> </td> <td class="c3" > 86 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6980-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 288 </td> <td class="s"> if ($node->[1] == P_EL) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6981">6981</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6982">6982</a> </td> <td class="c3" > 55 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 88 </td> <td class="s"> $i = $_; </td> </tr> <tr> <td class="h" > <a name="6983">6983</a> </td> <td class="c3" > 55 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 152 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6984">6984</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[1] & BUTTON_SCOPING_EL) { </td> </tr> <tr> <td class="h" > <a name="6985">6985</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6986">6986</a> </td> <td class="c3" > 6 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 16 </td> <td class="s"> last INSCOPE; </td> </tr> <tr> <td class="h" > <a name="6987">6987</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node->[1] & END_TAG_OPTIONAL_EL) { </td> </tr> <tr> <td class="h" > <a name="6988">6988</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: |END_TAG_OPTIONAL_EL| includes "p" </td> </tr> <tr> <td class="h" > <a name="6989">6989</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6990">6990</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # </td> </tr> <tr> <td class="h" > <a name="6991">6991</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="6992">6992</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="6993">6993</a> </td> <td class="c3" > 25 </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#6993-1"> 66 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 79 </td> <td class="s"> $non_optional ||= $node; </td> </tr> <tr> <td class="h" > <a name="6994">6994</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # </td> </tr> <tr> <td class="h" > <a name="6995">6995</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="6996">6996</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # INSCOPE </td> </tr> <tr> <td class="h" > <a name="6997">6997</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="6998">6998</a> </td> <td class="c3" > 61 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#6998-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 176 </td> <td class="s"> if (defined $i) { </td> </tr> <tr> <td class="h" > <a name="6999">6999</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 1. Generate implied end tags </td> </tr> <tr> <td class="h" > <a name="7000">7000</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # </td> </tr> <tr> <td class="h" > <a name="7001">7001</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7002">7002</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 2. If current node != "p", parse error </td> </tr> <tr> <td class="h" > <a name="7003">7003</a> </td> <td class="c3" > 55 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7003-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 147 </td> <td class="s"> if ($non_optional) { </td> </tr> <tr> <td class="h" > <a name="7004">7004</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7005">7005</a> </td> <td class="c3" > 14 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 117 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', </td> </tr> <tr> <td class="h" > <a name="7006">7006</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> text => $non_optional->[0]->tagName, </td> </tr> <tr> <td class="h" > <a name="7007">7007</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> token => $token); </td> </tr> <tr> <td class="h" > <a name="7008">7008</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7009">7009</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7010">7010</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7011">7011</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7012">7012</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 3. Pop </td> </tr> <tr> <td class="h" > <a name="7013">7013</a> </td> <td class="c3" > 55 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 114 </td> <td class="s"> splice @{$self->{open_elements}}, $i; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 55 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 171 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7014">7014</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7015">7015</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7016">7016</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', </td> </tr> <tr> <td class="h" > <a name="7017">7017</a> </td> <td class="c3" > 6 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 30 </td> <td class="s"> text => $token->{tag_name}, token => $token); </td> </tr> <tr> <td class="h" > <a name="7018">7018</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7019">7019</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7020">7020</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## As if <p>, then reprocess the current token </td> </tr> <tr> <td class="h" > <a name="7021">7021</a> </td> <td class="c3" > 6 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 11 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a name="7022">7022</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7023">7023</a> </td> <td class="c3" > 6 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 53 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), 'p'); </td> </tr> <tr> <td class="h" > <a name="7024">7024</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7025">7025</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="7026">7026</a> </td> <td class="c3" > 6 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7026-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 39 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="7027">7027</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="7028">7028</a> </td> <td class="c3" > 6 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7028-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 45 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="7029">7029</a> </td> <td class="c3" > 6 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 19 </td> <td class="s"> $self->_data($el, implied => __LINE__); </td> </tr> <tr> <td class="h" > <a name="7030">7030</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7031">7031</a> </td> <td class="c3" > 6 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 17 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="7032">7032</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: Not inserted into |$self->{open_elements}|. </td> </tr> <tr> <td class="h" > <a name="7033">7033</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7034">7034</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7035">7035</a> </td> <td class="c3" > 61 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 517 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="7036">7036</a> </td> <td class="c3" > 61 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 313 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="7037">7037</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ({ </td> </tr> <tr> <td class="h" > <a name="7038">7038</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> a => 1, </td> </tr> <tr> <td class="h" > <a name="7039">7039</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> b => 1, big => 1, code=>1, em => 1, font => 1, i => 1, </td> </tr> <tr> <td class="h" > <a name="7040">7040</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> nobr => 1, s => 1, small => 1, strike => 1, </td> </tr> <tr> <td class="h" > <a name="7041">7041</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> strong => 1, tt => 1, u => 1, </td> </tr> <tr> <td class="h" > <a name="7042">7042</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$token->{tag_name}}) { </td> </tr> <tr> <td class="h" > <a name="7043">7043</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7044">7044</a> </td> <td class="c3" > 118 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 471 </td> <td class="s"> $formatting_end_tag->($self, $active_formatting_elements, </td> </tr> <tr> <td class="h" > <a name="7045">7045</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $open_tables, $token); </td> </tr> <tr> <td class="h" > <a name="7046">7046</a> </td> <td class="c3" > 118 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 2182 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="7047">7047</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($token->{tag_name} eq 'br') { </td> </tr> <tr> <td class="h" > <a name="7048">7048</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7049">7049</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 21 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', </td> </tr> <tr> <td class="h" > <a name="7050">7050</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> text => 'br', token => $token); </td> </tr> <tr> <td class="h" > <a name="7051">7051</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7052">7052</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## As if <br> </td> </tr> <tr> <td class="h" > <a name="7053">7053</a> </td> <td class="c3" > 3 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7053-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 15 </td> <td class="s"> my $insert = $self->{insertion_mode} & TABLE_IMS </td> </tr> <tr> <td class="h" > <a name="7054">7054</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ? $insert_to_foster : $insert_to_current; </td> </tr> <tr> <td class="h" > <a name="7055">7055</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 11 </td> <td class="s"> $reconstruct_active_formatting_elements </td> </tr> <tr> <td class="h" > <a name="7056">7056</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->($self, $insert, $active_formatting_elements, $open_tables); </td> </tr> <tr> <td class="h" > <a name="7057">7057</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7058">7058</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> my $el; </td> </tr> <tr> <td class="h" > <a name="7059">7059</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 32 </td> <td class="s"> $el = $self->{document}->createElementNS((HTML_NS), 'br'); </td> </tr> <tr> <td class="h" > <a name="7060">7060</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7061">7061</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_line => $token->{line}) </td> </tr> <tr> <td class="h" > <a name="7062">7062</a> </td> <td class="c3" > 3 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7062-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 24 </td> <td class="s"> if defined $token->{line}; </td> </tr> <tr> <td class="h" > <a name="7063">7063</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->_data($el, manakai_source_column => $token->{column}) </td> </tr> <tr> <td class="h" > <a name="7064">7064</a> </td> <td class="c3" > 3 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7064-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 15 </td> <td class="s"> if defined $token->{column}; </td> </tr> <tr> <td class="h" > <a name="7065">7065</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7066">7066</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 12 </td> <td class="s"> $insert->($self, $el, $open_tables); </td> </tr> <tr> <td class="h" > <a name="7067">7067</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7068">7068</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Ignore the token. </td> </tr> <tr> <td class="h" > <a name="7069">7069</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 13 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="7070">7070</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 14 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="7071">7071</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7072">7072</a> </td> <td class="c3" > 58 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7072-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 267 </td> <td class="s"> if ($token->{tag_name} eq 'sarcasm') { </td> </tr> <tr> <td class="h" > <a name="7073">7073</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 118 </td> <td class="s"> sleep 0.001; # take a deep breath </td> </tr> <tr> <td class="h" > <a name="7074">7074</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7075">7075</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7076">7076</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 1 </td> </tr> <tr> <td class="h" > <a name="7077">7077</a> </td> <td class="c3" > 58 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 114 </td> <td class="s"> my $node_i = -1; </td> </tr> <tr> <td class="h" > <a name="7078">7078</a> </td> <td class="c3" > 58 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 135 </td> <td class="s"> my $node = $self->{open_elements}->[$node_i]; </td> </tr> <tr> <td class="h" > <a name="7079">7079</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7080">7080</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 2 </td> </tr> <tr> <td class="h" > <a name="7081">7081</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> LOOP: { </td> </tr> <tr> <td class="h" > <a name="7082">7082</a> </td> <td class="c3" > 58 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 97 </td> <td class="s"> my $node_tag_name = $node->[0]->tagName; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 62 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 360 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7083">7083</a> </td> <td class="c3" > 62 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 206 </td> <td class="s"> $node_tag_name =~ tr/A-Z/a-z/; # for SVG camelCase tag names </td> </tr> <tr> <td class="h" > <a name="7084">7084</a> </td> <td class="c3" > 62 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7084-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 183 </td> <td class="s"> if ($node_tag_name eq $token->{tag_name}) { </td> </tr> <tr> <td class="h" > <a name="7085">7085</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 1 </td> </tr> <tr> <td class="h" > <a name="7086">7086</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## generate implied end tags </td> </tr> <tr> <td class="h" > <a name="7087">7087</a> </td> <td class="c3" > 28 </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7087-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 169 </td> <td class="s"> while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL and </td> </tr> <tr> <td class="h" > <a name="7088">7088</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{open_elements}->[-1]->[0]->localname </td> </tr> <tr> <td class="h" > <a name="7089">7089</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ne $token->{tag_name}) { </td> </tr> <tr> <td class="h" > <a name="7090">7090</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7091">7091</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: |<ruby><rt></ruby>|. </td> </tr> <tr> <td class="h" > <a name="7092">7092</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 3 </td> <td class="s"> pop @{$self->{open_elements}}; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 4 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7093">7093</a> </td> <td class="c3" > 1 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 5 </td> <td class="s"> $node_i++; </td> </tr> <tr> <td class="h" > <a name="7094">7094</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7095">7095</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7096">7096</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 2 </td> </tr> <tr> <td class="h" > <a name="7097">7097</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $current_tag_name </td> </tr> <tr> <td class="h" > <a name="7098">7098</a> </td> <td class="c3" > 28 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 120 </td> <td class="s"> = $self->{open_elements}->[-1]->[0]->tagName; </td> </tr> <tr> <td class="h" > <a name="7099">7099</a> </td> <td class="c3" > 28 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 69 </td> <td class="s"> $current_tag_name =~ tr/A-Z/a-z/; </td> </tr> <tr> <td class="h" > <a name="7100">7100</a> </td> <td class="c3" > 28 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7100-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 81 </td> <td class="s"> if ($current_tag_name ne $token->{tag_name}) { </td> </tr> <tr> <td class="h" > <a name="7101">7101</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7102">7102</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: <x><y></x> </td> </tr> <tr> <td class="h" > <a name="7103">7103</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'not closed', </td> </tr> <tr> <td class="h" > <a name="7104">7104</a> </td> <td class="c0" > <a href="#7145"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> text => $self->{open_elements}->[-1]->[0] </td> </tr> <tr> <td class="h" > <a name="7105">7105</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ->tagName, </td> </tr> <tr> <td class="h" > <a name="7106">7106</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> token => $token); </td> </tr> <tr> <td class="h" > <a name="7107">7107</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7108">7108</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7109">7109</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7110">7110</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7111">7111</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 3 </td> </tr> <tr> <td class="h" > <a name="7112">7112</a> </td> <td class="c3" > 28 </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7112-1"> 50 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 78 </td> <td class="s"> splice @{$self->{open_elements}}, $node_i if $node_i < 0; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c3" > 28 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 86 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7113">7113</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7114">7114</a> </td> <td class="c3" > 28 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 108 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="7115">7115</a> </td> <td class="c3" > 28 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 110 </td> <td class="s"> last LOOP; </td> </tr> <tr> <td class="h" > <a name="7116">7116</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7117">7117</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 3 </td> </tr> <tr> <td class="h" > <a name="7118">7118</a> </td> <td class="c3" > 34 </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7118-1"> 100 </a> </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7118-1"> 100 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 128 </td> <td class="s"> if ($node->[1] & SPECIAL_EL or $node->[1] & SCOPING_EL) { ## "Special" </td> </tr> <tr> <td class="h" > <a name="7119">7119</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7120">7120</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'unmatched end tag', </td> </tr> <tr> <td class="h" > <a name="7121">7121</a> </td> <td class="c3" > 30 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 166 </td> <td class="s"> text => $token->{tag_name}, token => $token); </td> </tr> <tr> <td class="h" > <a name="7122">7122</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Ignore the token </td> </tr> <tr> <td class="h" > <a name="7123">7123</a> </td> <td class="c3" > 30 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 103 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="7124">7124</a> </td> <td class="c3" > 30 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 106 </td> <td class="s"> last LOOP; </td> </tr> <tr> <td class="h" > <a name="7125">7125</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7126">7126</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: |<span><dd></span>a|: In Safari 3.1.2 and Opera </td> </tr> <tr> <td class="h" > <a name="7127">7127</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## 9.27, "a" is a child of <dd> (conforming). In </td> </tr> <tr> <td class="h" > <a name="7128">7128</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Firefox 3.0.2, "a" is a child of <body>. In WinIE 7, </td> </tr> <tr> <td class="h" > <a name="7129">7129</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## "a" is a child of both <body> and <dd>. </td> </tr> <tr> <td class="h" > <a name="7130">7130</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7131">7131</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7132">7132</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7133">7133</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7134">7134</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7135">7135</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 4 </td> </tr> <tr> <td class="h" > <a name="7136">7136</a> </td> <td class="c3" > 4 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> $node_i--; </td> </tr> <tr> <td class="h" > <a name="7137">7137</a> </td> <td class="c3" > 4 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 8 </td> <td class="s"> $node = $self->{open_elements}->[$node_i]; </td> </tr> <tr> <td class="h" > <a name="7138">7138</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7139">7139</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 5; </td> </tr> <tr> <td class="h" > <a name="7140">7140</a> </td> <td class="c3" > 4 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 11 </td> <td class="s"> redo LOOP; </td> </tr> <tr> <td class="h" > <a name="7141">7141</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # LOOP </td> </tr> <tr> <td class="h" > <a name="7142">7142</a> </td> <td class="c3" > 58 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 313 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="7143">7143</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7144">7144</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7145">7145</a> </td> <td class="c0" > <a href="#7156"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> next B; </td> </tr> <tr> <td class="h" > <a name="7146">7146</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # B </td> </tr> <tr> <td class="h" > <a name="7147">7147</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7148">7148</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Stop parsing # MUST </td> </tr> <tr> <td class="h" > <a name="7149">7149</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7150">7150</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: script stuffs </td> </tr> <tr> <td class="h" > <a name="7151">7151</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # _tree_construct_main </td> </tr> <tr> <td class="h" > <a name="7152">7152</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7153">7153</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## XXX: How this method is organized is somewhat out of date, although </td> </tr> <tr> <td class="h" > <a name="7154">7154</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## it still does what the current spec documents. </td> </tr> <tr> <td class="h" > <a name="7155">7155</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> sub set_inner_html ($$$$;$) { </td> </tr> <tr> <td class="h" > <a name="7156">7156</a> </td> <td class="c0" > <a href="#7157"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7156-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7156-1"> 0 </a> </td> <td > 0 </td> <td class="s"> my ($class, $self); </td> </tr> <tr> <td class="h" > <a name="7157">7157</a> </td> <td class="c0" > <a href="#7158"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7157-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if (ref $_[0]) { </td> </tr> <tr> <td class="h" > <a name="7158">7158</a> </td> <td class="c0" > <a href="#7159"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self = shift; </td> </tr> <tr> <td class="h" > <a name="7159">7159</a> </td> <td class="c0" > <a href="#7161"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $class = ref $self; </td> </tr> <tr> <td class="h" > <a name="7160">7160</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7161">7161</a> </td> <td class="c0" > <a href="#7162"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $class = shift; </td> </tr> <tr> <td class="h" > <a name="7162">7162</a> </td> <td class="c0" > <a href="#7164"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self = $class->new; </td> </tr> <tr> <td class="h" > <a name="7163">7163</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7164">7164</a> </td> <td class="c0" > <a href="#7166"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $node = shift; # /context/ </td> </tr> <tr> <td class="h" > <a name="7165">7165</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #my $s = \$_[0]; </td> </tr> <tr> <td class="h" > <a name="7166">7166</a> </td> <td class="c0" > <a href="#7167"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $onerror = $_[1]; </td> </tr> <tr> <td class="h" > <a name="7167">7167</a> </td> <td class="c0" > <a href="#&nbsp;"> 0 </a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7167-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7167-1"> 0 </a> </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $get_wrapper = $_[2] || sub ($) { return $_[0] }; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c0" > <a href="#7169"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7168">7168</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7169">7169</a> </td> <td class="c0" > <a href="#7170"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $nt = $node->node_type; #TOBY-TODO </td> </tr> <tr> <td class="h" > <a name="7170">7170</a> </td> <td class="c0" > <a href="#7178"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7170-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($nt == 9) { # Document (invoke the algorithm with no /context/ element) </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7171">7171</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # MUST </td> </tr> <tr> <td class="h" > <a name="7172">7172</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7173">7173</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 1 # MUST </td> </tr> <tr> <td class="h" > <a name="7174">7174</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: If the document has an active parser, ... </td> </tr> <tr> <td class="h" > <a name="7175">7175</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## ISSUE: There is an issue in the spec. </td> </tr> <tr> <td class="h" > <a name="7176">7176</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7177">7177</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 2 # MUST </td> </tr> <tr> <td class="h" > <a name="7178">7178</a> </td> <td class="c0" > <a href="#7179"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my @cn = $node->childNodes; </td> </tr> <tr> <td class="h" > <a name="7179">7179</a> </td> <td class="c0" > <a href="#7180"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> for (@cn) { </td> </tr> <tr> <td class="h" > <a name="7180">7180</a> </td> <td class="c0" > <a href="#7184"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $node->removeChild ($_); </td> </tr> <tr> <td class="h" > <a name="7181">7181</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7182">7182</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7183">7183</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 3, 4, 5 # MUST </td> </tr> <tr> <td class="h" > <a name="7184">7184</a> </td> <td class="c0" > <a href="#7193"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->parse_char_string ($_[0] => $node, $onerror, $get_wrapper); </td> </tr> <tr> <td class="h" > <a name="7185">7185</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($nt == 1) { # Element (invoke the algorithm with /context/ element) </td> </tr> <tr> <td class="h" > <a name="7186">7186</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: If non-html element </td> </tr> <tr> <td class="h" > <a name="7187">7187</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7188">7188</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## NOTE: Most of this code is copied from |parse_string| </td> </tr> <tr> <td class="h" > <a name="7189">7189</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7190">7190</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: Support for $get_wrapper </td> </tr> <tr> <td class="h" > <a name="7191">7191</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #TOBY-TODO </td> </tr> <tr> <td class="h" > <a name="7192">7192</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F1. Create an HTML document. </td> </tr> <tr> <td class="h" > <a name="7193">7193</a> </td> <td class="c0" > <a href="#7194"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $this_doc = $node->ownerDocument; </td> </tr> <tr> <td class="h" > <a name="7194">7194</a> </td> <td class="c0" > <a href="#7195"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $implementation = ref($this_doc); </td> </tr> <tr> <td class="h" > <a name="7195">7195</a> </td> <td class="c0" > <a href="#7196"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $doc = $implementation->createDocument; </td> </tr> <tr> <td class="h" > <a name="7196">7196</a> </td> <td class="c0" > <a href="#7199"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($doc, manakai_is_html => 1); </td> </tr> <tr> <td class="h" > <a name="7197">7197</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7198">7198</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F2. Propagate quirkness flag </td> </tr> <tr> <td class="h" > <a name="7199">7199</a> </td> <td class="c0" > <a href="#7200"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $node_doc = $node->ownerDocument; </td> </tr> <tr> <td class="h" > <a name="7200">7200</a> </td> <td class="c0" > <a href="#7203"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->_data($doc)->{'manakai_compat_mode'} = $self->_data($node_doc, 'manakai_compat_mode'); </td> </tr> <tr> <td class="h" > <a name="7201">7201</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7202">7202</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F3. Create an HTML parser </td> </tr> <tr> <td class="h" > <a name="7203">7203</a> </td> <td class="c0" > <a href="#7204"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $p = $self; </td> </tr> <tr> <td class="h" > <a name="7204">7204</a> </td> <td class="c0" > <a href="#7207"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{document} = $doc; </td> </tr> <tr> <td class="h" > <a name="7205">7205</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7206">7206</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 8 # MUST </td> </tr> <tr> <td class="h" > <a name="7207">7207</a> </td> <td class="c0" > <a href="#7208"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $i = 0; </td> </tr> <tr> <td class="h" > <a name="7208">7208</a> </td> <td class="c0" > <a href="#7209"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{line_prev} = $p->{line} = 1; </td> </tr> <tr> <td class="h" > <a name="7209">7209</a> </td> <td class="c0" > <a href="#7210"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{column_prev} = $p->{column} = 0; </td> </tr> <tr> <td class="h" > <a name="7210">7210</a> </td> <td class="c0" > <a href="#7211"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> require HTML::HTML5::Parser::Charset::DecodeHandle; </td> </tr> <tr> <td class="h" > <a name="7211">7211</a> </td> <td class="c0" > <a href="#7212"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $input = HTML::HTML5::Parser::Charset::DecodeHandle::CharString->new (\($_[0])); </td> </tr> <tr> <td class="h" > <a name="7212">7212</a> </td> <td class="c0" > <a href="#7214"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $input = $get_wrapper->($input); </td> </tr> <tr> <td class="h" > <a name="7213">7213</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $p->{set_nc} = sub { </td> </tr> <tr> <td class="h" > <a name="7214">7214</a> </td> <td class="c0" > <a href="#7216"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7214-1"> 0 </a> </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $self = shift; </td> </tr> <tr> <td class="h" > <a name="7215">7215</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7216">7216</a> </td> <td class="c0" > <a href="#7217"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $char = ''; </td> </tr> <tr> <td class="h" > <a name="7217">7217</a> </td> <td class="c0" > <a href="#7218"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7217-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if (defined $self->{next_nc}) { </td> </tr> <tr> <td class="h" > <a name="7218">7218</a> </td> <td class="c0" > <a href="#7219"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $char = $self->{next_nc}; </td> </tr> <tr> <td class="h" > <a name="7219">7219</a> </td> <td class="c0" > <a href="#7220"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> delete $self->{next_nc}; </td> </tr> <tr> <td class="h" > <a name="7220">7220</a> </td> <td class="c0" > <a href="#7222"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{nc} = ord $char; </td> </tr> <tr> <td class="h" > <a name="7221">7221</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7222">7222</a> </td> <td class="c0" > <a href="#7223"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{char_buffer} = ''; </td> </tr> <tr> <td class="h" > <a name="7223">7223</a> </td> <td class="c0" > <a href="#7227"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{char_buffer_pos} = 0; </td> </tr> <tr> <td class="h" > <a name="7224">7224</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7225">7225</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $count = $input->manakai_read_until </td> </tr> <tr> <td class="h" > <a name="7226">7226</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ($self->{char_buffer}, qr/[^\x00\x0A\x0D\x{D800}-\x{DFFF}]/, </td> </tr> <tr> <td class="h" > <a name="7227">7227</a> </td> <td class="c0" > <a href="#7228"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{char_buffer_pos}); </td> </tr> <tr> <td class="h" > <a name="7228">7228</a> </td> <td class="c0" > <a href="#7229"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7228-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($count) { </td> </tr> <tr> <td class="h" > <a name="7229">7229</a> </td> <td class="c0" > <a href="#7230"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{line_prev} = $self->{line}; </td> </tr> <tr> <td class="h" > <a name="7230">7230</a> </td> <td class="c0" > <a href="#7231"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{column_prev} = $self->{column}; </td> </tr> <tr> <td class="h" > <a name="7231">7231</a> </td> <td class="c0" > <a href="#7234"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{column}++; </td> </tr> <tr> <td class="h" > <a name="7232">7232</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $self->{nc} </td> </tr> <tr> <td class="h" > <a name="7233">7233</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> = ord substr ($self->{char_buffer}, </td> </tr> <tr> <td class="h" > <a name="7234">7234</a> </td> <td class="c0" > <a href="#7235"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{char_buffer_pos}++, 1); </td> </tr> <tr> <td class="h" > <a name="7235">7235</a> </td> <td class="c0" > <a href="#7238"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> return; </td> </tr> <tr> <td class="h" > <a name="7236">7236</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7237">7237</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7238">7238</a> </td> <td class="c0" > <a href="#7239"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7238-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($input->read ($char, 1)) { </td> </tr> <tr> <td class="h" > <a name="7239">7239</a> </td> <td class="c0" > <a href="#7241"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{nc} = ord $char; </td> </tr> <tr> <td class="h" > <a name="7240">7240</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7241">7241</a> </td> <td class="c0" > <a href="#7242"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{nc} = -1; </td> </tr> <tr> <td class="h" > <a name="7242">7242</a> </td> <td class="c0" > <a href="#7246"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> return; </td> </tr> <tr> <td class="h" > <a name="7243">7243</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7244">7244</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7245">7245</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7246">7246</a> </td> <td class="c0" > <a href="#7247"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> ($p->{line_prev}, $p->{column_prev}) = ($p->{line}, $p->{column}); </td> </tr> <tr> <td class="h" > <a name="7247">7247</a> </td> <td class="c0" > <a href="#7249"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{column}++; </td> </tr> <tr> <td class="h" > <a name="7248">7248</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7249">7249</a> </td> <td class="c0" > <a href="#7250"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7249-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7249-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($self->{nc} == 0x000A) { # LF </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7250">7250</a> </td> <td class="c0" > <a href="#7251"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{line}++; </td> </tr> <tr> <td class="h" > <a name="7251">7251</a> </td> <td class="c0" > <a href="#7255"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{column} = 0; </td> </tr> <tr> <td class="h" > <a name="7252">7252</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7253">7253</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($self->{nc} == 0x000D) { # CR </td> </tr> <tr> <td class="h" > <a name="7254">7254</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## TODO: support for abort/streaming </td> </tr> <tr> <td class="h" > <a name="7255">7255</a> </td> <td class="c0" > <a href="#7256"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $next = ''; </td> </tr> <tr> <td class="h" > <a name="7256">7256</a> </td> <td class="c0" > <a href="#7257"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7256-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7256-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($input->read ($next, 1) and $next ne "\x0A") { </td> </tr> <tr> <td class="h" > <a name="7257">7257</a> </td> <td class="c0" > <a href="#7259"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{next_nc} = $next; </td> </tr> <tr> <td class="h" > <a name="7258">7258</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7259">7259</a> </td> <td class="c0" > <a href="#7260"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{nc} = 0x000A; # LF # MUST </td> </tr> <tr> <td class="h" > <a name="7260">7260</a> </td> <td class="c0" > <a href="#7261"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{line}++; </td> </tr> <tr> <td class="h" > <a name="7261">7261</a> </td> <td class="c0" > <a href="#7265"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{column} = 0; </td> </tr> <tr> <td class="h" > <a name="7262">7262</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7263">7263</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif (0xD800 <= $self->{nc} and $self->{nc} <= 0xDFFF) { </td> </tr> <tr> <td class="h" > <a name="7264">7264</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7265">7265</a> </td> <td class="c0" > <a href="#7266"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{parse_error}->(level => $self->{level}->{must}, type => 'surrogate'); ## XXX documentation </td> </tr> <tr> <td class="h" > <a name="7266">7266</a> </td> <td class="c0" > <a href="#7268"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $self->{nc} = 0xFFFD; # REPLACEMENT CHARACTER # MUST </td> </tr> <tr> <td class="h" > <a name="7267">7267</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7268">7268</a> </td> <td class="c0" > <a href="#7272"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> }; </td> </tr> <tr> <td class="h" > <a name="7269">7269</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7270">7270</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $p->{read_until} = sub { </td> </tr> <tr> <td class="h" > <a name="7271">7271</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #my ($scalar, $specials_range, $offset) = @_; </td> </tr> <tr> <td class="h" > <a name="7272">7272</a> </td> <td class="c0" > <a href="#7274"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7272-1"> 0 </a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7272-1"> 0 </a> </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> return 0 if defined $p->{next_nc}; </td> </tr> <tr> <td class="h" > <a name="7273">7273</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7274">7274</a> </td> <td class="c0" > <a href="#7275"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $pattern = qr/[^$_[1]\x00\x0A\x0D\x{D800}-\x{DFFF}]/; </td> </tr> <tr> <td class="h" > <a name="7275">7275</a> </td> <td class="c0" > <a href="#7277"> 0 </a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7275-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $offset = $_[2] || 0; </td> </tr> <tr> <td class="h" > <a name="7276">7276</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7277">7277</a> </td> <td class="c0" > <a href="#7278"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7277-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($p->{char_buffer_pos} < length $p->{char_buffer}) { </td> </tr> <tr> <td class="h" > <a name="7278">7278</a> </td> <td class="c0" > <a href="#7279"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> pos ($p->{char_buffer}) = $p->{char_buffer_pos}; </td> </tr> <tr> <td class="h" > <a name="7279">7279</a> </td> <td class="c0" > <a href="#7281"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7279-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($p->{char_buffer} =~ /\G(?>$pattern)+/) { </td> </tr> <tr> <td class="h" > <a name="7280">7280</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> substr ($_[0], $offset) </td> </tr> <tr> <td class="h" > <a name="7281">7281</a> </td> <td class="c0" > <a href="#7282"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> = substr ($p->{char_buffer}, $-[0], $+[0] - $-[0]); </td> </tr> <tr> <td class="h" > <a name="7282">7282</a> </td> <td class="c0" > <a href="#7283"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $count = $+[0] - $-[0]; </td> </tr> <tr> <td class="h" > <a name="7283">7283</a> </td> <td class="c0" > <a href="#7284"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7283-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($count) { </td> </tr> <tr> <td class="h" > <a name="7284">7284</a> </td> <td class="c0" > <a href="#7285"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{column} += $count; </td> </tr> <tr> <td class="h" > <a name="7285">7285</a> </td> <td class="c0" > <a href="#7286"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{char_buffer_pos} += $count; </td> </tr> <tr> <td class="h" > <a name="7286">7286</a> </td> <td class="c0" > <a href="#7287"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{line_prev} = $p->{line}; </td> </tr> <tr> <td class="h" > <a name="7287">7287</a> </td> <td class="c0" > <a href="#7288"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{column_prev} = $p->{column} - 1; </td> </tr> <tr> <td class="h" > <a name="7288">7288</a> </td> <td class="c0" > <a href="#7290"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{nc} = -1; </td> </tr> <tr> <td class="h" > <a name="7289">7289</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7290">7290</a> </td> <td class="c0" > <a href="#7292"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> return $count; </td> </tr> <tr> <td class="h" > <a name="7291">7291</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7292">7292</a> </td> <td class="c0" > <a href="#7295"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> return 0; </td> </tr> <tr> <td class="h" > <a name="7293">7293</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7294">7294</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7295">7295</a> </td> <td class="c0" > <a href="#7296"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $count = $input->manakai_read_until ($_[0], $pattern, $_[2]); </td> </tr> <tr> <td class="h" > <a name="7296">7296</a> </td> <td class="c0" > <a href="#7297"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7296-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($count) { </td> </tr> <tr> <td class="h" > <a name="7297">7297</a> </td> <td class="c0" > <a href="#7298"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{column} += $count; </td> </tr> <tr> <td class="h" > <a name="7298">7298</a> </td> <td class="c0" > <a href="#7299"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{column_prev} += $count; </td> </tr> <tr> <td class="h" > <a name="7299">7299</a> </td> <td class="c0" > <a href="#7301"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{nc} = -1; </td> </tr> <tr> <td class="h" > <a name="7300">7300</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7301">7301</a> </td> <td class="c0" > <a href="#7303"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> return $count; </td> </tr> <tr> <td class="h" > <a name="7302">7302</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7303">7303</a> </td> <td class="c0" > <a href="#7306"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> }; # $p->{read_until} </td> </tr> <tr> <td class="h" > <a name="7304">7304</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7305">7305</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $ponerror = $onerror || sub { </td> </tr> <tr> <td class="h" > <a name="7306">7306</a> </td> <td class="c0" > <a href="#7307"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7306-1"> 0 </a> </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my (%opt) = @_; </td> </tr> <tr> <td class="h" > <a name="7307">7307</a> </td> <td class="c0" > <a href="#7308"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $line = $opt{line}; </td> </tr> <tr> <td class="h" > <a name="7308">7308</a> </td> <td class="c0" > <a href="#7309"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $column = $opt{column}; </td> </tr> <tr> <td class="h" > <a name="7309">7309</a> </td> <td class="c0" > <a href="#7310"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if (defined $opt{token} and defined $opt{token}->{line}) { </td> </tr> <tr> <td class="h" > <a name="7310">7310</a> </td> <td class="c0" > <a href="#7311"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $line = $opt{token}->{line}; </td> </tr> <tr> <td class="h" > <a name="7311">7311</a> </td> <td class="c0" > <a href="#7313"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $column = $opt{token}->{column}; </td> </tr> <tr> <td class="h" > <a name="7312">7312</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7313">7313</a> </td> <td class="c0" > <a href="#7314"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> warn "Parse error ($opt{type}) at line $line column $column\n"; </td> </tr> <tr> <td class="h" > <a name="7314">7314</a> </td> <td class="c0" > <a href="#7316"> 0 </a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7314-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> }; </td> </tr> <tr> <td class="h" > <a name="7315">7315</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $p->{parse_error} = sub { </td> </tr> <tr> <td class="h" > <a name="7316">7316</a> </td> <td class="c0" > <a href="#7317"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7316-1"> 0 </a> </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $ponerror->(line => $p->{line}, column => $p->{column}, @_); </td> </tr> <tr> <td class="h" > <a name="7317">7317</a> </td> <td class="c0" > <a href="#7320"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> }; </td> </tr> <tr> <td class="h" > <a name="7318">7318</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7319">7319</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $char_onerror = sub { </td> </tr> <tr> <td class="h" > <a name="7320">7320</a> </td> <td class="c0" > <a href="#7322"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7320-1"> 0 </a> </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my (undef, $type, %opt) = @_; </td> </tr> <tr> <td class="h" > <a name="7321">7321</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $ponerror->(layer => 'encode', </td> </tr> <tr> <td class="h" > <a name="7322">7322</a> </td> <td class="c0" > <a href="#7324"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> line => $p->{line}, column => $p->{column} + 1, </td> </tr> <tr> <td class="h" > <a name="7323">7323</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> %opt, type => $type); </td> </tr> <tr> <td class="h" > <a name="7324">7324</a> </td> <td class="c0" > <a href="#7325"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> }; # $char_onerror </td> </tr> <tr> <td class="h" > <a name="7325">7325</a> </td> <td class="c0" > <a href="#7327"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $input->onerror ($char_onerror); </td> </tr> <tr> <td class="h" > <a name="7326">7326</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7327">7327</a> </td> <td class="c0" > <a href="#7328"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->_initialize_tokenizer; </td> </tr> <tr> <td class="h" > <a name="7328">7328</a> </td> <td class="c0" > <a href="#7333"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->_initialize_tree_constructor; </td> </tr> <tr> <td class="h" > <a name="7329">7329</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7330">7330</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F4. If /context/ is not undef... </td> </tr> <tr> <td class="h" > <a name="7331">7331</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7332">7332</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F4.1. content model flag </td> </tr> <tr> <td class="h" > <a name="7333">7333</a> </td> <td class="c0" > <a href="#7334"> 0 </a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7333-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $node_ns = $node->namespaceURI || ''; </td> </tr> <tr> <td class="h" > <a name="7334">7334</a> </td> <td class="c0" > <a href="#7335"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $node_ln = $node->localname; </td> </tr> <tr> <td class="h" > <a name="7335">7335</a> </td> <td class="c0" > <a href="#7336"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7335-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($node_ns eq HTML_NS) { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7336">7336</a> </td> <td class="c0" > <a href="#7337"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7336-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7336-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($node_ln eq 'title' or $node_ln eq 'textarea') { </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-2"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-3"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#-4"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7337">7337</a> </td> <td class="c0" > <a href="#7339"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{state} = RCDATA_STATE; </td> </tr> <tr> <td class="h" > <a name="7338">7338</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node_ln eq 'script') { </td> </tr> <tr> <td class="h" > <a name="7339">7339</a> </td> <td class="c0" > <a href="#7349"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{state} = SCRIPT_DATA_STATE; </td> </tr> <tr> <td class="h" > <a name="7340">7340</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ({ </td> </tr> <tr> <td class="h" > <a name="7341">7341</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> style => 1, </td> </tr> <tr> <td class="h" > <a name="7342">7342</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> script => 1, </td> </tr> <tr> <td class="h" > <a name="7343">7343</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> xmp => 1, </td> </tr> <tr> <td class="h" > <a name="7344">7344</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> iframe => 1, </td> </tr> <tr> <td class="h" > <a name="7345">7345</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> noembed => 1, </td> </tr> <tr> <td class="h" > <a name="7346">7346</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> noframes => 1, </td> </tr> <tr> <td class="h" > <a name="7347">7347</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> noscript => 1, </td> </tr> <tr> <td class="h" > <a name="7348">7348</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }->{$node_ln}) { </td> </tr> <tr> <td class="h" > <a name="7349">7349</a> </td> <td class="c0" > <a href="#7351"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{state} = RAWTEXT_STATE; </td> </tr> <tr> <td class="h" > <a name="7350">7350</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node_ln eq 'plaintext') { </td> </tr> <tr> <td class="h" > <a name="7351">7351</a> </td> <td class="c0" > <a href="#7354"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{state} = PLAINTEXT_STATE; </td> </tr> <tr> <td class="h" > <a name="7352">7352</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7353">7353</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7354">7354</a> </td> <td class="c0" > <a href="#7357"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{inner_html_node} = [$node, $el_category->{$node_ln}]; </td> </tr> <tr> <td class="h" > <a name="7355">7355</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node_ns eq SVG_NS) { </td> </tr> <tr> <td class="h" > <a name="7356">7356</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $p->{inner_html_node} = [$node, </td> </tr> <tr> <td class="h" > <a name="7357">7357</a> </td> <td class="c0" > <a href="#7361"> 0 </a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7357-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $el_category_f->{$node_ns}->{$node_ln} </td> </tr> <tr> <td class="h" > <a name="7358">7358</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> || FOREIGN_EL | SVG_EL]; </td> </tr> <tr> <td class="h" > <a name="7359">7359</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } elsif ($node_ns eq MML_NS) { </td> </tr> <tr> <td class="h" > <a name="7360">7360</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $p->{inner_html_node} = [$node, </td> </tr> <tr> <td class="h" > <a name="7361">7361</a> </td> <td class="c0" > <a href="#7364"> 0 </a> </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7361-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $el_category_f->{$node_ns}->{$node_ln} </td> </tr> <tr> <td class="h" > <a name="7362">7362</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> || FOREIGN_EL | MML_EL]; </td> </tr> <tr> <td class="h" > <a name="7363">7363</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7364">7364</a> </td> <td class="c0" > <a href="#7368"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{inner_html_node} = [$node, FOREIGN_EL]; </td> </tr> <tr> <td class="h" > <a name="7365">7365</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7366">7366</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7367">7367</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F4.2. Root |html| element </td> </tr> <tr> <td class="h" > <a name="7368">7368</a> </td> <td class="c0" > <a href="#7371"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $root = $doc->createElementNS('http://www.w3.org/1999/xhtml', 'html'); </td> </tr> <tr> <td class="h" > <a name="7369">7369</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7370">7370</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F4.3. </td> </tr> <tr> <td class="h" > <a name="7371">7371</a> </td> <td class="c0" > <a href="#7374"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $doc->appendChild ($root); </td> </tr> <tr> <td class="h" > <a name="7372">7372</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7373">7373</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F4.4. </td> </tr> <tr> <td class="h" > <a name="7374">7374</a> </td> <td class="c0" > <a href="#&nbsp;"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> push @{$p->{open_elements}}, [$root, $el_category->{html}]; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c0" > <a href="#7376"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7375">7375</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7376">7376</a> </td> <td class="c0" > <a href="#7379"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> undef $p->{head_element}; </td> </tr> <tr> <td class="h" > <a name="7377">7377</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7378">7378</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F4.5. </td> </tr> <tr> <td class="h" > <a name="7379">7379</a> </td> <td class="c0" > <a href="#7382"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->_reset_insertion_mode; </td> </tr> <tr> <td class="h" > <a name="7380">7380</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7381">7381</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F4.6. </td> </tr> <tr> <td class="h" > <a name="7382">7382</a> </td> <td class="c0" > <a href="#7383"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $anode = $node; </td> </tr> <tr> <td class="h" > <a name="7383">7383</a> </td> <td class="c0" > <a href="#7384"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> AN: while (defined $anode) { </td> </tr> <tr> <td class="h" > <a name="7384">7384</a> </td> <td class="c0" > <a href="#7385"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7384-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($anode->node_type == 1) { </td> </tr> <tr> <td class="h" > <a name="7385">7385</a> </td> <td class="c0" > <a href="#7386"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $nsuri = $anode->namespaceURI; </td> </tr> <tr> <td class="h" > <a name="7386">7386</a> </td> <td class="c0" > <a href="#7387"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7386-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--condition.html#7386-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if (defined $nsuri and $nsuri eq 'http://www.w3.org/1999/xhtml') { </td> </tr> <tr> <td class="h" > <a name="7387">7387</a> </td> <td class="c0" > <a href="#7389"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--branch.html#7387-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> if ($anode->tagName eq 'form') { </td> </tr> <tr> <td class="h" > <a name="7388">7388</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="7389">7389</a> </td> <td class="c0" > <a href="#7390"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{form_element} = $anode; </td> </tr> <tr> <td class="h" > <a name="7390">7390</a> </td> <td class="c0" > <a href="#7394"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> last AN; </td> </tr> <tr> <td class="h" > <a name="7391">7391</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7392">7392</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7393">7393</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7394">7394</a> </td> <td class="c0" > <a href="#7398"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $anode = $anode->parentNode; </td> </tr> <tr> <td class="h" > <a name="7395">7395</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # AN </td> </tr> <tr> <td class="h" > <a name="7396">7396</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7397">7397</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F.5. Set the input stream. </td> </tr> <tr> <td class="h" > <a name="7398">7398</a> </td> <td class="c0" > <a href="#7402"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->{confident} = 1; ## Confident: irrelevant. </td> </tr> <tr> <td class="h" > <a name="7399">7399</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7400">7400</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F.6. Start the parser. </td> </tr> <tr> <td class="h" > <a name="7401">7401</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="7402">7402</a> </td> <td class="c0" > <a href="#&nbsp;"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my $self = $p; </td> </tr> <tr> <td class="h" > <a >&nbsp;</a> </td> <td class="c0" > <a href="#7403"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7403">7403</a> </td> <td class="c0" > <a href="#7405"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $token = $self->_get_next_token; </td> </tr> <tr> <td class="h" > <a name="7404">7404</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7405">7405</a> </td> <td class="c0" > <a href="#7408"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->_tree_construction_main; </td> </tr> <tr> <td class="h" > <a name="7406">7406</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7407">7407</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## F.7. </td> </tr> <tr> <td class="h" > <a name="7408">7408</a> </td> <td class="c0" > <a href="#7409"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> my @cn = $node->childNodes; </td> </tr> <tr> <td class="h" > <a name="7409">7409</a> </td> <td class="c0" > <a href="#7410"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> for (@cn) { </td> </tr> <tr> <td class="h" > <a name="7410">7410</a> </td> <td class="c0" > <a href="#7415"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $node->removeChild ($_); </td> </tr> <tr> <td class="h" > <a name="7411">7411</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7412">7412</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## ISSUE: mutation events? read-only? </td> </tr> <tr> <td class="h" > <a name="7413">7413</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7414">7414</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Step 11 # MUST </td> </tr> <tr> <td class="h" > <a name="7415">7415</a> </td> <td class="c0" > <a href="#7416"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> @cn = $root->childNodes; </td> </tr> <tr> <td class="h" > <a name="7416">7416</a> </td> <td class="c0" > <a href="#7417"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> for (@cn) { </td> </tr> <tr> <td class="h" > <a name="7417">7417</a> </td> <td class="c0" > <a href="#7418"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $this_doc->adoptNode ($_); </td> </tr> <tr> <td class="h" > <a name="7418">7418</a> </td> <td class="c0" > <a href="#7422"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $node->appendChild ($_); </td> </tr> <tr> <td class="h" > <a name="7419">7419</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7420">7420</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## ISSUE: mutation events? </td> </tr> <tr> <td class="h" > <a name="7421">7421</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7422">7422</a> </td> <td class="c0" > <a href="#7425"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> $p->_terminate_tree_constructor; </td> </tr> <tr> <td class="h" > <a name="7423">7423</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7424">7424</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## Remove self references. </td> </tr> <tr> <td class="h" > <a name="7425">7425</a> </td> <td class="c0" > <a href="#7426"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> delete $p->{set_nc}; </td> </tr> <tr> <td class="h" > <a name="7426">7426</a> </td> <td class="c0" > <a href="#7427"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> delete $p->{read_until}; </td> </tr> <tr> <td class="h" > <a name="7427">7427</a> </td> <td class="c0" > <a href="#7429"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> delete $p->{parse_error}; </td> </tr> <tr> <td class="h" > <a name="7428">7428</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="7429">7429</a> </td> <td class="c0" > 0 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 0 </td> <td class="s"> die "$0: |set_inner_html| is not defined for node of type $nt"; </td> </tr> <tr> <td class="h" > <a name="7430">7430</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7431">7431</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # set_inner_html </td> </tr> <tr> <td class="h" > <a name="7432">7432</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7433">7433</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } # tree construction stage </td> </tr> <tr> <td class="h" > <a name="7434">7434</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7435">7435</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> package HTML::HTML5::Parser::TagSoupParser::RestartParser; </td> </tr> <tr> <td class="h" > <a name="7436">7436</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7437">7437</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> sub new </td> </tr> <tr> <td class="h" > <a name="7438">7438</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="7439">7439</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7439-1"> 3 </a> </td> <td > &nbsp; </td> <td > 9 </td> <td class="s"> my ($class, %opts) = @_; </td> </tr> <tr> <td class="h" > <a name="7440">7440</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 23 </td> <td class="s"> bless \%opts => $class; </td> </tr> <tr> <td class="h" > <a name="7441">7441</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7442">7442</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7443">7443</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> sub throw </td> </tr> <tr> <td class="h" > <a name="7444">7444</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> { </td> </tr> <tr> <td class="h" > <a name="7445">7445</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c3" > <a href="blib-lib-HTML-HTML5-Parser-TagSoupParser-pm--subroutine.html#7445-1"> 3 </a> </td> <td > &nbsp; </td> <td > 7 </td> <td class="s"> my ($class, %opts) = @_; </td> </tr> <tr> <td class="h" > <a name="7446">7446</a> </td> <td class="c3" > 3 </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > 10 </td> <td class="s"> die $class->new(%opts); </td> </tr> <tr> <td class="h" > <a name="7447">7447</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="7448">7448</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="7449">7449</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> 1; </td> </tr> <tr> <td class="h" > <a name="7450">7450</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # $Date: 2009/09/06 23:32:06 $ </td> </tr> </table> </body> </html>