| 12 |
## TODO: 1252 parse error (revision 1264) |
## TODO: 1252 parse error (revision 1264) |
| 13 |
## TODO: 8859-11 = 874 (revision 1271) |
## TODO: 8859-11 = 874 (revision 1271) |
| 14 |
|
|
| 15 |
|
my $HTML_NS = q<http://www.w3.org/1999/xhtml>; |
| 16 |
|
my $MML_NS = q<http://www.w3.org/1998/Math/MathML>; |
| 17 |
|
my $SVG_NS = q<http://www.w3.org/2000/svg>; |
| 18 |
|
my $XLINK_NS = q<http://www.w3.org/1999/xlink>; |
| 19 |
|
my $XML_NS = q<http://www.w3.org/XML/1998/namespace>; |
| 20 |
|
my $XMLNS_NS = q<http://www.w3.org/2000/xmlns/>; |
| 21 |
|
|
| 22 |
sub A_EL () { 0b1 } |
sub A_EL () { 0b1 } |
| 23 |
sub ADDRESS_EL () { 0b10 } |
sub ADDRESS_EL () { 0b10 } |
| 24 |
sub BODY_EL () { 0b100 } |
sub BODY_EL () { 0b100 } |
| 44 |
sub TABLE_ROW_GROUP_EL () { 0b10000000000000000000000 } |
sub TABLE_ROW_GROUP_EL () { 0b10000000000000000000000 } |
| 45 |
sub MISC_SCOPING_EL () { 0b100000000000000000000000 } |
sub MISC_SCOPING_EL () { 0b100000000000000000000000 } |
| 46 |
sub MISC_SPECIAL_EL () { 0b1000000000000000000000000 } |
sub MISC_SPECIAL_EL () { 0b1000000000000000000000000 } |
| 47 |
|
sub FOREIGN_EL () { 0b10000000000000000000000000 } |
| 48 |
|
sub FOREIGN_FLOW_CONTENT_EL () { 0b100000000000000000000000000 } |
| 49 |
|
sub MML_AXML_EL () { 0b1000000000000000000000000000 } |
| 50 |
|
|
| 51 |
sub TABLE_ROWS_EL () { |
sub TABLE_ROWS_EL () { |
| 52 |
TABLE_EL | |
TABLE_EL | |
| 195 |
wbr => MISC_SPECIAL_EL, |
wbr => MISC_SPECIAL_EL, |
| 196 |
}; |
}; |
| 197 |
|
|
| 198 |
|
my $el_category_f = { |
| 199 |
|
$MML_NS => { |
| 200 |
|
'annotation-xml' => MML_AXML_EL, |
| 201 |
|
mi => FOREIGN_FLOW_CONTENT_EL, |
| 202 |
|
mo => FOREIGN_FLOW_CONTENT_EL, |
| 203 |
|
mn => FOREIGN_FLOW_CONTENT_EL, |
| 204 |
|
ms => FOREIGN_FLOW_CONTENT_EL, |
| 205 |
|
mtext => FOREIGN_FLOW_CONTENT_EL, |
| 206 |
|
}, |
| 207 |
|
$SVG_NS => { |
| 208 |
|
foreignobject => FOREIGN_FLOW_CONTENT_EL, ## TODO: case |
| 209 |
|
desc => FOREIGN_FLOW_CONTENT_EL, |
| 210 |
|
title => FOREIGN_FLOW_CONTENT_EL, |
| 211 |
|
}, |
| 212 |
|
## NOTE: In addition, FOREIGN_EL is set to non-HTML elements. |
| 213 |
|
}; |
| 214 |
|
|
| 215 |
my $c1_entity_char = { |
my $c1_entity_char = { |
| 216 |
0x80 => 0x20AC, |
0x80 => 0x20AC, |
| 217 |
0x81 => 0xFFFD, |
0x81 => 0xFFFD, |
| 460 |
sub BOGUS_DOCTYPE_STATE () { 32 } |
sub BOGUS_DOCTYPE_STATE () { 32 } |
| 461 |
sub AFTER_ATTRIBUTE_VALUE_QUOTED_STATE () { 33 } |
sub AFTER_ATTRIBUTE_VALUE_QUOTED_STATE () { 33 } |
| 462 |
sub SELF_CLOSING_START_TAG_STATE () { 34 } |
sub SELF_CLOSING_START_TAG_STATE () { 34 } |
| 463 |
|
sub CDATA_BLOCK_STATE () { 35 } |
| 464 |
|
|
| 465 |
sub DOCTYPE_TOKEN () { 1 } |
sub DOCTYPE_TOKEN () { 1 } |
| 466 |
sub COMMENT_TOKEN () { 2 } |
sub COMMENT_TOKEN () { 2 } |
| 478 |
sub BODY_AFTER_IMS () { 0b100000000 } |
sub BODY_AFTER_IMS () { 0b100000000 } |
| 479 |
sub FRAME_IMS () { 0b1000000000 } |
sub FRAME_IMS () { 0b1000000000 } |
| 480 |
sub SELECT_IMS () { 0b10000000000 } |
sub SELECT_IMS () { 0b10000000000 } |
| 481 |
|
sub IN_FOREIGN_CONTENT_IM () { 0b100000000000 } |
| 482 |
|
## NOTE: "in foreign content" insertion mode is special; it is combined |
| 483 |
|
## with the secondary insertion mode. In this parser, they are stored |
| 484 |
|
## together in the bit-or'ed form. |
| 485 |
|
|
| 486 |
## NOTE: "initial" and "before html" insertion modes have no constants. |
## NOTE: "initial" and "before html" insertion modes have no constants. |
| 487 |
|
|
| 1686 |
} else { |
} else { |
| 1687 |
!!!cp (135); |
!!!cp (135); |
| 1688 |
} |
} |
| 1689 |
|
} elsif ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM and |
| 1690 |
|
$self->{open_elements}->[-1]->[1] & FOREIGN_EL and |
| 1691 |
|
$self->{next_char} == 0x005B) { # [ |
| 1692 |
|
!!!next-input-character; |
| 1693 |
|
push @next_char, $self->{next_char}; |
| 1694 |
|
if ($self->{next_char} == 0x0043) { # C |
| 1695 |
|
!!!next-input-character; |
| 1696 |
|
push @next_char, $self->{next_char}; |
| 1697 |
|
if ($self->{next_char} == 0x0044) { # D |
| 1698 |
|
!!!next-input-character; |
| 1699 |
|
push @next_char, $self->{next_char}; |
| 1700 |
|
if ($self->{next_char} == 0x0041) { # A |
| 1701 |
|
!!!next-input-character; |
| 1702 |
|
push @next_char, $self->{next_char}; |
| 1703 |
|
if ($self->{next_char} == 0x0054) { # T |
| 1704 |
|
!!!next-input-character; |
| 1705 |
|
push @next_char, $self->{next_char}; |
| 1706 |
|
if ($self->{next_char} == 0x0041) { # A |
| 1707 |
|
!!!next-input-character; |
| 1708 |
|
push @next_char, $self->{next_char}; |
| 1709 |
|
if ($self->{next_char} == 0x005B) { # [ |
| 1710 |
|
!!!cp (135.1); |
| 1711 |
|
$self->{state} = CDATA_BLOCK_STATE; |
| 1712 |
|
!!!next-input-character; |
| 1713 |
|
redo A; |
| 1714 |
|
} else { |
| 1715 |
|
!!!cp (135.2); |
| 1716 |
|
} |
| 1717 |
|
} else { |
| 1718 |
|
!!!cp (135.3); |
| 1719 |
|
} |
| 1720 |
|
} else { |
| 1721 |
|
!!!cp (135.4); |
| 1722 |
|
} |
| 1723 |
|
} else { |
| 1724 |
|
!!!cp (135.5); |
| 1725 |
|
} |
| 1726 |
|
} else { |
| 1727 |
|
!!!cp (135.6); |
| 1728 |
|
} |
| 1729 |
|
} else { |
| 1730 |
|
!!!cp (135.7); |
| 1731 |
|
} |
| 1732 |
} else { |
} else { |
| 1733 |
!!!cp (136); |
!!!cp (136); |
| 1734 |
} |
} |
| 2453 |
!!!next-input-character; |
!!!next-input-character; |
| 2454 |
redo A; |
redo A; |
| 2455 |
} |
} |
| 2456 |
|
} elsif ($self->{state} == CDATA_BLOCK_STATE) { |
| 2457 |
|
my $s = ''; |
| 2458 |
|
|
| 2459 |
|
my ($l, $c) = ($self->{line}, $self->{column}); |
| 2460 |
|
|
| 2461 |
|
CS: while ($self->{next_char} != -1) { |
| 2462 |
|
if ($self->{next_char} == 0x005D) { # ] |
| 2463 |
|
!!!next-input-character; |
| 2464 |
|
if ($self->{next_char} == 0x005D) { # ] |
| 2465 |
|
!!!next-input-character; |
| 2466 |
|
MDC: { |
| 2467 |
|
if ($self->{next_char} == 0x003E) { # > |
| 2468 |
|
!!!cp (221.1); |
| 2469 |
|
!!!next-input-character; |
| 2470 |
|
last CS; |
| 2471 |
|
} elsif ($self->{next_char} == 0x005D) { # ] |
| 2472 |
|
!!!cp (221.2); |
| 2473 |
|
$s .= ']'; |
| 2474 |
|
!!!next-input-character; |
| 2475 |
|
redo MDC; |
| 2476 |
|
} else { |
| 2477 |
|
!!!cp (221.3); |
| 2478 |
|
$s .= ']]'; |
| 2479 |
|
# |
| 2480 |
|
} |
| 2481 |
|
} # MDC |
| 2482 |
|
} else { |
| 2483 |
|
!!!cp (221.4); |
| 2484 |
|
$s .= ']'; |
| 2485 |
|
# |
| 2486 |
|
} |
| 2487 |
|
} else { |
| 2488 |
|
!!!cp (221.5); |
| 2489 |
|
# |
| 2490 |
|
} |
| 2491 |
|
$s .= chr $self->{next_char}; |
| 2492 |
|
!!!next-input-character; |
| 2493 |
|
} # CS |
| 2494 |
|
|
| 2495 |
|
$self->{state} = DATA_STATE; |
| 2496 |
|
## next-input-character done or EOF, which is reconsumed. |
| 2497 |
|
|
| 2498 |
|
if (length $s) { |
| 2499 |
|
!!!cp (221.6); |
| 2500 |
|
!!!emit ({type => CHARACTER_TOKEN, data => $s, |
| 2501 |
|
line => $l, column => $c}); |
| 2502 |
|
} else { |
| 2503 |
|
!!!cp (221.7); |
| 2504 |
|
} |
| 2505 |
|
|
| 2506 |
|
redo A; |
| 2507 |
|
|
| 2508 |
|
## ISSUE: "text tokens" in spec. |
| 2509 |
|
## TODO: Streaming support |
| 2510 |
} else { |
} else { |
| 2511 |
die "$0: $self->{state}: Unknown state"; |
die "$0: $self->{state}: Unknown state"; |
| 2512 |
} |
} |
| 2657 |
require Whatpm::_NamedEntityList; |
require Whatpm::_NamedEntityList; |
| 2658 |
our $EntityChar; |
our $EntityChar; |
| 2659 |
|
|
| 2660 |
while (length $entity_name < 10 and |
while (length $entity_name < 30 and |
| 2661 |
## NOTE: Some number greater than the maximum length of entity name |
## NOTE: Some number greater than the maximum length of entity name |
| 2662 |
((0x0041 <= $self->{next_char} and # a |
((0x0041 <= $self->{next_char} and # a |
| 2663 |
$self->{next_char} <= 0x005A) or # x |
$self->{next_char} <= 0x005A) or # x |
| 3018 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 3019 |
if ($token->{tag_name} eq 'html') { |
if ($token->{tag_name} eq 'html') { |
| 3020 |
my $root_element; |
my $root_element; |
| 3021 |
!!!create-element ($root_element, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($root_element, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
| 3022 |
$self->{document}->append_child ($root_element); |
$self->{document}->append_child ($root_element); |
| 3023 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
| 3024 |
[$root_element, $el_category->{html}]; |
[$root_element, $el_category->{html}]; |
| 3054 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 3055 |
} |
} |
| 3056 |
|
|
| 3057 |
my $root_element; !!!create-element ($root_element, 'html',, $token); |
my $root_element; |
| 3058 |
|
!!!create-element ($root_element, $HTML_NS, 'html',, $token); |
| 3059 |
$self->{document}->append_child ($root_element); |
$self->{document}->append_child ($root_element); |
| 3060 |
push @{$self->{open_elements}}, [$root_element, $el_category->{html}]; |
push @{$self->{open_elements}}, [$root_element, $el_category->{html}]; |
| 3061 |
|
|
| 3096 |
} |
} |
| 3097 |
} |
} |
| 3098 |
|
|
| 3099 |
## Step 4..13 |
## Step 4..14 |
| 3100 |
my $new_mode = { |
my $new_mode; |
| 3101 |
|
if ($node->[1] & FOREIGN_EL) { |
| 3102 |
|
## NOTE: Strictly spaking, the line below only applies to MathML and |
| 3103 |
|
## SVG elements. Currently the HTML syntax supports only MathML and |
| 3104 |
|
## SVG elements as foreigners. |
| 3105 |
|
$new_mode = $self->{insertion_mode} | IN_FOREIGN_CONTENT_IM; |
| 3106 |
|
## ISSUE: What is set as the secondary insertion mode? |
| 3107 |
|
} else { |
| 3108 |
|
$new_mode = { |
| 3109 |
select => IN_SELECT_IM, |
select => IN_SELECT_IM, |
| 3110 |
## NOTE: |option| and |optgroup| do not set |
## NOTE: |option| and |optgroup| do not set |
| 3111 |
## insertion mode to "in select" by themselves. |
## insertion mode to "in select" by themselves. |
| 3122 |
body => IN_BODY_IM, |
body => IN_BODY_IM, |
| 3123 |
frameset => IN_FRAMESET_IM, |
frameset => IN_FRAMESET_IM, |
| 3124 |
}->{$node->[0]->manakai_local_name}; |
}->{$node->[0]->manakai_local_name}; |
| 3125 |
## TODO: Foreign namespace case OK? |
} |
| 3126 |
$self->{insertion_mode} = $new_mode and return if defined $new_mode; |
$self->{insertion_mode} = $new_mode and return if defined $new_mode; |
| 3127 |
|
|
| 3128 |
## Step 14 |
## Step 15 |
| 3129 |
if ($node->[1] & HTML_EL) { |
if ($node->[1] & HTML_EL) { |
| 3130 |
unless (defined $self->{head_element}) { |
unless (defined $self->{head_element}) { |
| 3131 |
!!!cp ('t29'); |
!!!cp ('t29'); |
| 3140 |
!!!cp ('t31'); |
!!!cp ('t31'); |
| 3141 |
} |
} |
| 3142 |
|
|
| 3143 |
## Step 15 |
## Step 16 |
| 3144 |
$self->{insertion_mode} = IN_BODY_IM and return if $last; |
$self->{insertion_mode} = IN_BODY_IM and return if $last; |
| 3145 |
|
|
| 3146 |
## Step 16 |
## Step 17 |
| 3147 |
$i--; |
$i--; |
| 3148 |
$node = $self->{open_elements}->[$i]; |
$node = $self->{open_elements}->[$i]; |
| 3149 |
|
|
| 3150 |
## Step 17 |
## Step 18 |
| 3151 |
redo S3; |
redo S3; |
| 3152 |
} # S3 |
} # S3 |
| 3153 |
|
|
| 3259 |
## Step 1 |
## Step 1 |
| 3260 |
my $start_tag_name = $token->{tag_name}; |
my $start_tag_name = $token->{tag_name}; |
| 3261 |
my $el; |
my $el; |
| 3262 |
!!!create-element ($el, $start_tag_name, $token->{attributes}, $token); |
!!!create-element ($el, $HTML_NS, $start_tag_name, $token->{attributes}, $token); |
| 3263 |
|
|
| 3264 |
## Step 2 |
## Step 2 |
| 3265 |
$insert->($el); |
$insert->($el); |
| 3310 |
|
|
| 3311 |
my $script_start_tag = sub () { |
my $script_start_tag = sub () { |
| 3312 |
my $script_el; |
my $script_el; |
| 3313 |
!!!create-element ($script_el, 'script', $token->{attributes}, $token); |
!!!create-element ($script_el, $HTML_NS, 'script', $token->{attributes}, $token); |
| 3314 |
## TODO: mark as "parser-inserted" |
## TODO: mark as "parser-inserted" |
| 3315 |
|
|
| 3316 |
$self->{content_model} = CDATA_CONTENT_MODEL; |
$self->{content_model} = CDATA_CONTENT_MODEL; |
| 3633 |
} |
} |
| 3634 |
}; # $insert_to_foster |
}; # $insert_to_foster |
| 3635 |
|
|
| 3636 |
B: { |
B: while (1) { |
| 3637 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
| 3638 |
!!!cp ('t73'); |
!!!cp ('t73'); |
| 3639 |
!!!parse-error (type => 'DOCTYPE in the middle', token => $token); |
!!!parse-error (type => 'DOCTYPE in the middle', token => $token); |
| 3640 |
## Ignore the token |
## Ignore the token |
| 3641 |
## Stay in the phase |
## Stay in the phase |
| 3642 |
!!!next-token; |
!!!next-token; |
| 3643 |
redo B; |
next B; |
| 3644 |
} elsif ($token->{type} == START_TAG_TOKEN and |
} elsif ($token->{type} == START_TAG_TOKEN and |
| 3645 |
$token->{tag_name} eq 'html') { |
$token->{tag_name} eq 'html') { |
| 3646 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
| 3668 |
} |
} |
| 3669 |
!!!nack ('t84.1'); |
!!!nack ('t84.1'); |
| 3670 |
!!!next-token; |
!!!next-token; |
| 3671 |
redo B; |
next B; |
| 3672 |
} elsif ($token->{type} == COMMENT_TOKEN) { |
} elsif ($token->{type} == COMMENT_TOKEN) { |
| 3673 |
my $comment = $self->{document}->create_comment ($token->{data}); |
my $comment = $self->{document}->create_comment ($token->{data}); |
| 3674 |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
| 3682 |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
| 3683 |
} |
} |
| 3684 |
!!!next-token; |
!!!next-token; |
| 3685 |
redo B; |
next B; |
| 3686 |
} elsif ($self->{insertion_mode} & HEAD_IMS) { |
} elsif ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM) { |
| 3687 |
|
if ($token->{type} == CHARACTER_TOKEN) { |
| 3688 |
|
!!!cp ('t87.1'); |
| 3689 |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 3690 |
|
!!!next-token; |
| 3691 |
|
next B; |
| 3692 |
|
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 3693 |
|
if ((not {mglyph => 1, malignmark => 1}->{$token->{tag_name}} and |
| 3694 |
|
$self->{open_elements}->[-1]->[1] & FOREIGN_FLOW_CONTENT_EL) or |
| 3695 |
|
not ($self->{open_elements}->[-1]->[1] & FOREIGN_EL) or |
| 3696 |
|
($token->{tag_name} eq 'svg' and |
| 3697 |
|
$self->{open_elements}->[-1]->[1] & MML_AXML_EL)) { |
| 3698 |
|
## NOTE: "using the rules for secondary insertion mode"then"continue" |
| 3699 |
|
!!!cp ('t87.2'); |
| 3700 |
|
# |
| 3701 |
|
} elsif ({ |
| 3702 |
|
## TODO: |
| 3703 |
|
}->{$token->{tag_name}}) { |
| 3704 |
|
!!!cp ('t87.2'); |
| 3705 |
|
!!!parse-error (type => 'not closed', |
| 3706 |
|
value => $self->{open_elements}->[-1]->[0] |
| 3707 |
|
->manakai_local_name, |
| 3708 |
|
token => $token); |
| 3709 |
|
|
| 3710 |
|
pop @{$self->{open_elements}} |
| 3711 |
|
while $self->{open_elements}->[-1]->[1] & FOREIGN_EL; |
| 3712 |
|
|
| 3713 |
|
$self->{insertion_mode} &= ~ $self->{insertion_mode}; |
| 3714 |
|
## Reprocess. |
| 3715 |
|
next B; |
| 3716 |
|
} else { |
| 3717 |
|
## TODO: case fixup |
| 3718 |
|
|
| 3719 |
|
!!!insert-element-f ($self->{open_elements}->[-1]->[0]->namespace_uri, $token); |
| 3720 |
|
|
| 3721 |
|
if ($self->{self_closing}) { |
| 3722 |
|
pop @{$self->{open_elements}}; |
| 3723 |
|
!!!ack ('t87.3'); |
| 3724 |
|
} else { |
| 3725 |
|
!!!cp ('t87.4'); |
| 3726 |
|
} |
| 3727 |
|
|
| 3728 |
|
!!!next-token; |
| 3729 |
|
next B; |
| 3730 |
|
} |
| 3731 |
|
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 3732 |
|
## NOTE: "using the rules for secondary insertion mode" then "continue" |
| 3733 |
|
!!!cp ('t87.5'); |
| 3734 |
|
# |
| 3735 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 3736 |
|
## NOTE: "using the rules for secondary insertion mode" then "continue" |
| 3737 |
|
!!!cp ('t87.6'); |
| 3738 |
|
# |
| 3739 |
|
## TODO: ... |
| 3740 |
|
} else { |
| 3741 |
|
die "$0: $token->{type}: Unknown token type"; |
| 3742 |
|
} |
| 3743 |
|
} |
| 3744 |
|
|
| 3745 |
|
if ($self->{insertion_mode} & HEAD_IMS) { |
| 3746 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 3747 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
| 3748 |
unless ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
unless ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3752 |
!!!cp ('t88.1'); |
!!!cp ('t88.1'); |
| 3753 |
## Ignore the token. |
## Ignore the token. |
| 3754 |
!!!next-token; |
!!!next-token; |
| 3755 |
redo B; |
next B; |
| 3756 |
} |
} |
| 3757 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 3758 |
!!!cp ('t88'); |
!!!cp ('t88'); |
| 3759 |
!!!next-token; |
!!!next-token; |
| 3760 |
redo B; |
next B; |
| 3761 |
} |
} |
| 3762 |
} |
} |
| 3763 |
|
|
| 3764 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3765 |
!!!cp ('t89'); |
!!!cp ('t89'); |
| 3766 |
## As if <head> |
## As if <head> |
| 3767 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 3768 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 3769 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
| 3770 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
| 3798 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 3799 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 3800 |
## reprocess |
## reprocess |
| 3801 |
redo B; |
next B; |
| 3802 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 3803 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
| 3804 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3805 |
!!!cp ('t93'); |
!!!cp ('t93'); |
| 3806 |
!!!create-element ($self->{head_element}, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
| 3807 |
$self->{open_elements}->[-1]->[0]->append_child |
$self->{open_elements}->[-1]->[0]->append_child |
| 3808 |
($self->{head_element}); |
($self->{head_element}); |
| 3809 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
| 3811 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
| 3812 |
!!!nack ('t93.1'); |
!!!nack ('t93.1'); |
| 3813 |
!!!next-token; |
!!!next-token; |
| 3814 |
redo B; |
next B; |
| 3815 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 3816 |
!!!cp ('t94'); |
!!!cp ('t94'); |
| 3817 |
# |
# |
| 3821 |
## Ignore the token |
## Ignore the token |
| 3822 |
!!!nack ('t95.1'); |
!!!nack ('t95.1'); |
| 3823 |
!!!next-token; |
!!!next-token; |
| 3824 |
redo B; |
next B; |
| 3825 |
} |
} |
| 3826 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3827 |
!!!cp ('t96'); |
!!!cp ('t96'); |
| 3828 |
## As if <head> |
## As if <head> |
| 3829 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 3830 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 3831 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
| 3832 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
| 3833 |
|
|
| 3834 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
| 3835 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
| 3836 |
} else { |
} else { |
| 3837 |
!!!cp ('t97'); |
!!!cp ('t97'); |
| 3838 |
} |
} |
| 3839 |
|
|
| 3840 |
if ($token->{tag_name} eq 'base') { |
if ($token->{tag_name} eq 'base') { |
| 3841 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 3865 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 3866 |
!!!nack ('t101.1'); |
!!!nack ('t101.1'); |
| 3867 |
!!!next-token; |
!!!next-token; |
| 3868 |
redo B; |
next B; |
| 3869 |
} elsif ($token->{tag_name} eq 'link') { |
} elsif ($token->{tag_name} eq 'link') { |
| 3870 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
| 3871 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 3882 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 3883 |
!!!ack ('t103.1'); |
!!!ack ('t103.1'); |
| 3884 |
!!!next-token; |
!!!next-token; |
| 3885 |
redo B; |
next B; |
| 3886 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
| 3887 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
| 3888 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 3947 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 3948 |
!!!ack ('t110.1'); |
!!!ack ('t110.1'); |
| 3949 |
!!!next-token; |
!!!next-token; |
| 3950 |
redo B; |
next B; |
| 3951 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
| 3952 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 3953 |
!!!cp ('t111'); |
!!!cp ('t111'); |
| 3972 |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
| 3973 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 3974 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 3975 |
redo B; |
next B; |
| 3976 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
| 3977 |
## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and |
## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and |
| 3978 |
## insertion mode IN_HEAD_IM) |
## insertion mode IN_HEAD_IM) |
| 3988 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 3989 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 3990 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 3991 |
redo B; |
next B; |
| 3992 |
} elsif ($token->{tag_name} eq 'noscript') { |
} elsif ($token->{tag_name} eq 'noscript') { |
| 3993 |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
| 3994 |
!!!cp ('t116'); |
!!!cp ('t116'); |
| 3997 |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
| 3998 |
!!!nack ('t116.1'); |
!!!nack ('t116.1'); |
| 3999 |
!!!next-token; |
!!!next-token; |
| 4000 |
redo B; |
next B; |
| 4001 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 4002 |
!!!cp ('t117'); |
!!!cp ('t117'); |
| 4003 |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
| 4004 |
## Ignore the token |
## Ignore the token |
| 4005 |
!!!nack ('t117.1'); |
!!!nack ('t117.1'); |
| 4006 |
!!!next-token; |
!!!next-token; |
| 4007 |
redo B; |
next B; |
| 4008 |
} else { |
} else { |
| 4009 |
!!!cp ('t118'); |
!!!cp ('t118'); |
| 4010 |
# |
# |
| 4031 |
$script_start_tag->(); |
$script_start_tag->(); |
| 4032 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 4033 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 4034 |
redo B; |
next B; |
| 4035 |
} elsif ($token->{tag_name} eq 'body' or |
} elsif ($token->{tag_name} eq 'body' or |
| 4036 |
$token->{tag_name} eq 'frameset') { |
$token->{tag_name} eq 'frameset') { |
| 4037 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 4067 |
} |
} |
| 4068 |
!!!nack ('t127.1'); |
!!!nack ('t127.1'); |
| 4069 |
!!!next-token; |
!!!next-token; |
| 4070 |
redo B; |
next B; |
| 4071 |
} else { |
} else { |
| 4072 |
!!!cp ('t128'); |
!!!cp ('t128'); |
| 4073 |
# |
# |
| 4100 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 4101 |
## reprocess |
## reprocess |
| 4102 |
!!!ack-later; |
!!!ack-later; |
| 4103 |
redo B; |
next B; |
| 4104 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 4105 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
| 4106 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4107 |
!!!cp ('t132'); |
!!!cp ('t132'); |
| 4108 |
## As if <head> |
## As if <head> |
| 4109 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 4110 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 4111 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
| 4112 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
| 4115 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4116 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
| 4117 |
!!!next-token; |
!!!next-token; |
| 4118 |
redo B; |
next B; |
| 4119 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 4120 |
!!!cp ('t133'); |
!!!cp ('t133'); |
| 4121 |
## As if </noscript> |
## As if </noscript> |
| 4126 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4127 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
| 4128 |
!!!next-token; |
!!!next-token; |
| 4129 |
redo B; |
next B; |
| 4130 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
| 4131 |
!!!cp ('t134'); |
!!!cp ('t134'); |
| 4132 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4133 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
| 4134 |
!!!next-token; |
!!!next-token; |
| 4135 |
redo B; |
next B; |
| 4136 |
} else { |
} else { |
| 4137 |
!!!cp ('t135'); |
!!!cp ('t135'); |
| 4138 |
# |
# |
| 4143 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4144 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
| 4145 |
!!!next-token; |
!!!next-token; |
| 4146 |
redo B; |
next B; |
| 4147 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4148 |
!!!cp ('t137'); |
!!!cp ('t137'); |
| 4149 |
!!!parse-error (type => 'unmatched end tag:noscript', token => $token); |
!!!parse-error (type => 'unmatched end tag:noscript', token => $token); |
| 4150 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
| 4151 |
!!!next-token; |
!!!next-token; |
| 4152 |
redo B; |
next B; |
| 4153 |
} else { |
} else { |
| 4154 |
!!!cp ('t138'); |
!!!cp ('t138'); |
| 4155 |
# |
# |
| 4160 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4161 |
!!!cp ('t139'); |
!!!cp ('t139'); |
| 4162 |
## As if <head> |
## As if <head> |
| 4163 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 4164 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 4165 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
| 4166 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
| 4172 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4173 |
## Ignore the token |
## Ignore the token |
| 4174 |
!!!next-token; |
!!!next-token; |
| 4175 |
redo B; |
next B; |
| 4176 |
} else { |
} else { |
| 4177 |
!!!cp ('t141'); |
!!!cp ('t141'); |
| 4178 |
} |
} |
| 4184 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4185 |
!!!cp ('t142'); |
!!!cp ('t142'); |
| 4186 |
## As if <head> |
## As if <head> |
| 4187 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 4188 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 4189 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
| 4190 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
| 4205 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4206 |
## Ignore the token |
## Ignore the token |
| 4207 |
!!!next-token; |
!!!next-token; |
| 4208 |
redo B; |
next B; |
| 4209 |
} |
} |
| 4210 |
} |
} |
| 4211 |
|
|
| 4232 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4233 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
| 4234 |
!!!next-token; |
!!!next-token; |
| 4235 |
redo B; |
next B; |
| 4236 |
} else { |
} else { |
| 4237 |
!!!cp ('t149'); |
!!!cp ('t149'); |
| 4238 |
} |
} |
| 4242 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 4243 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 4244 |
## reprocess |
## reprocess |
| 4245 |
redo B; |
next B; |
| 4246 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 4247 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4248 |
!!!cp ('t149.1'); |
!!!cp ('t149.1'); |
| 4249 |
|
|
| 4250 |
## NOTE: As if <head> |
## NOTE: As if <head> |
| 4251 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 4252 |
$self->{open_elements}->[-1]->[0]->append_child |
$self->{open_elements}->[-1]->[0]->append_child |
| 4253 |
($self->{head_element}); |
($self->{head_element}); |
| 4254 |
#push @{$self->{open_elements}}, |
#push @{$self->{open_elements}}, |
| 4296 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 4297 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 4298 |
## NOTE: Reprocess. |
## NOTE: Reprocess. |
| 4299 |
redo B; |
next B; |
| 4300 |
} else { |
} else { |
| 4301 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 4302 |
} |
} |
| 4311 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 4312 |
|
|
| 4313 |
!!!next-token; |
!!!next-token; |
| 4314 |
redo B; |
next B; |
| 4315 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 4316 |
if ({ |
if ({ |
| 4317 |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
| 4330 |
tag_name => $node->[0]->manakai_local_name, |
tag_name => $node->[0]->manakai_local_name, |
| 4331 |
line => $token->{line}, |
line => $token->{line}, |
| 4332 |
column => $token->{column}}; |
column => $token->{column}}; |
| 4333 |
redo B; |
next B; |
| 4334 |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
| 4335 |
!!!cp ('t152'); |
!!!cp ('t152'); |
| 4336 |
## ISSUE: This case can never be reached, maybe. |
## ISSUE: This case can never be reached, maybe. |
| 4344 |
## Ignore the token |
## Ignore the token |
| 4345 |
!!!nack ('t153.1'); |
!!!nack ('t153.1'); |
| 4346 |
!!!next-token; |
!!!next-token; |
| 4347 |
redo B; |
next B; |
| 4348 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
| 4349 |
!!!parse-error (type => 'not closed:caption', token => $token); |
!!!parse-error (type => 'not closed:caption', token => $token); |
| 4350 |
|
|
| 4370 |
## Ignore the token |
## Ignore the token |
| 4371 |
!!!nack ('t157.1'); |
!!!nack ('t157.1'); |
| 4372 |
!!!next-token; |
!!!next-token; |
| 4373 |
redo B; |
next B; |
| 4374 |
} # INSCOPE |
} # INSCOPE |
| 4375 |
|
|
| 4376 |
## generate implied end tags |
## generate implied end tags |
| 4398 |
|
|
| 4399 |
## reprocess |
## reprocess |
| 4400 |
!!!ack-later; |
!!!ack-later; |
| 4401 |
redo B; |
next B; |
| 4402 |
} else { |
} else { |
| 4403 |
!!!cp ('t161'); |
!!!cp ('t161'); |
| 4404 |
# |
# |
| 4428 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4429 |
## Ignore the token |
## Ignore the token |
| 4430 |
!!!next-token; |
!!!next-token; |
| 4431 |
redo B; |
next B; |
| 4432 |
} |
} |
| 4433 |
|
|
| 4434 |
## generate implied end tags |
## generate implied end tags |
| 4456 |
$self->{insertion_mode} = IN_ROW_IM; |
$self->{insertion_mode} = IN_ROW_IM; |
| 4457 |
|
|
| 4458 |
!!!next-token; |
!!!next-token; |
| 4459 |
redo B; |
next B; |
| 4460 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
| 4461 |
!!!cp ('t169'); |
!!!cp ('t169'); |
| 4462 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4463 |
## Ignore the token |
## Ignore the token |
| 4464 |
!!!next-token; |
!!!next-token; |
| 4465 |
redo B; |
next B; |
| 4466 |
} else { |
} else { |
| 4467 |
!!!cp ('t170'); |
!!!cp ('t170'); |
| 4468 |
# |
# |
| 4489 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
| 4490 |
## Ignore the token |
## Ignore the token |
| 4491 |
!!!next-token; |
!!!next-token; |
| 4492 |
redo B; |
next B; |
| 4493 |
} # INSCOPE |
} # INSCOPE |
| 4494 |
|
|
| 4495 |
## generate implied end tags |
## generate implied end tags |
| 4516 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 4517 |
|
|
| 4518 |
!!!next-token; |
!!!next-token; |
| 4519 |
redo B; |
next B; |
| 4520 |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
| 4521 |
!!!cp ('t177'); |
!!!cp ('t177'); |
| 4522 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4523 |
## Ignore the token |
## Ignore the token |
| 4524 |
!!!next-token; |
!!!next-token; |
| 4525 |
redo B; |
next B; |
| 4526 |
} else { |
} else { |
| 4527 |
!!!cp ('t178'); |
!!!cp ('t178'); |
| 4528 |
# |
# |
| 4547 |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
| 4548 |
line => $token->{line}, |
line => $token->{line}, |
| 4549 |
column => $token->{column}}; |
column => $token->{column}}; |
| 4550 |
redo B; |
next B; |
| 4551 |
} elsif ($node->[1] & TABLE_CELL_EL) { |
} elsif ($node->[1] & TABLE_CELL_EL) { |
| 4552 |
!!!cp ('t180'); |
!!!cp ('t180'); |
| 4553 |
$tn = $node->[0]->manakai_local_name; |
$tn = $node->[0]->manakai_local_name; |
| 4565 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
| 4566 |
## Ignore the token |
## Ignore the token |
| 4567 |
!!!next-token; |
!!!next-token; |
| 4568 |
redo B; |
next B; |
| 4569 |
} # INSCOPE |
} # INSCOPE |
| 4570 |
} elsif ($token->{tag_name} eq 'table' and |
} elsif ($token->{tag_name} eq 'table' and |
| 4571 |
$self->{insertion_mode} == IN_CAPTION_IM) { |
$self->{insertion_mode} == IN_CAPTION_IM) { |
| 4590 |
!!!parse-error (type => 'unmatched end tag:caption', token => $token); |
!!!parse-error (type => 'unmatched end tag:caption', token => $token); |
| 4591 |
## Ignore the token |
## Ignore the token |
| 4592 |
!!!next-token; |
!!!next-token; |
| 4593 |
redo B; |
next B; |
| 4594 |
} |
} |
| 4595 |
|
|
| 4596 |
## generate implied end tags |
## generate implied end tags |
| 4616 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 4617 |
|
|
| 4618 |
## reprocess |
## reprocess |
| 4619 |
redo B; |
next B; |
| 4620 |
} elsif ({ |
} elsif ({ |
| 4621 |
body => 1, col => 1, colgroup => 1, html => 1, |
body => 1, col => 1, colgroup => 1, html => 1, |
| 4622 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 4625 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4626 |
## Ignore the token |
## Ignore the token |
| 4627 |
!!!next-token; |
!!!next-token; |
| 4628 |
redo B; |
next B; |
| 4629 |
} else { |
} else { |
| 4630 |
!!!cp ('t191'); |
!!!cp ('t191'); |
| 4631 |
# |
# |
| 4639 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4640 |
## Ignore the token |
## Ignore the token |
| 4641 |
!!!next-token; |
!!!next-token; |
| 4642 |
redo B; |
next B; |
| 4643 |
} else { |
} else { |
| 4644 |
!!!cp ('t193'); |
!!!cp ('t193'); |
| 4645 |
# |
# |
| 4670 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 4671 |
!!!cp ('t194'); |
!!!cp ('t194'); |
| 4672 |
!!!next-token; |
!!!next-token; |
| 4673 |
redo B; |
next B; |
| 4674 |
} else { |
} else { |
| 4675 |
!!!cp ('t195'); |
!!!cp ('t195'); |
| 4676 |
} |
} |
| 4725 |
} |
} |
| 4726 |
|
|
| 4727 |
!!!next-token; |
!!!next-token; |
| 4728 |
redo B; |
next B; |
| 4729 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 4730 |
if ({ |
if ({ |
| 4731 |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
| 4764 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 4765 |
!!!nack ('t204'); |
!!!nack ('t204'); |
| 4766 |
!!!next-token; |
!!!next-token; |
| 4767 |
redo B; |
next B; |
| 4768 |
} else { |
} else { |
| 4769 |
!!!cp ('t205'); |
!!!cp ('t205'); |
| 4770 |
!!!insert-element ('tr',, $token); |
!!!insert-element ('tr',, $token); |
| 4788 |
|
|
| 4789 |
!!!nack ('t207.1'); |
!!!nack ('t207.1'); |
| 4790 |
!!!next-token; |
!!!next-token; |
| 4791 |
redo B; |
next B; |
| 4792 |
} elsif ({ |
} elsif ({ |
| 4793 |
caption => 1, col => 1, colgroup => 1, |
caption => 1, col => 1, colgroup => 1, |
| 4794 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
| 4816 |
## Ignore the token |
## Ignore the token |
| 4817 |
!!!nack ('t210.1'); |
!!!nack ('t210.1'); |
| 4818 |
!!!next-token; |
!!!next-token; |
| 4819 |
redo B; |
next B; |
| 4820 |
} |
} |
| 4821 |
|
|
| 4822 |
## Clear back to table row context |
## Clear back to table row context |
| 4833 |
!!!cp ('t212'); |
!!!cp ('t212'); |
| 4834 |
## reprocess |
## reprocess |
| 4835 |
!!!ack-later; |
!!!ack-later; |
| 4836 |
redo B; |
next B; |
| 4837 |
} else { |
} else { |
| 4838 |
!!!cp ('t213'); |
!!!cp ('t213'); |
| 4839 |
## reprocess in the "in table body" insertion mode... |
## reprocess in the "in table body" insertion mode... |
| 4861 |
## Ignore the token |
## Ignore the token |
| 4862 |
!!!nack ('t216.1'); |
!!!nack ('t216.1'); |
| 4863 |
!!!next-token; |
!!!next-token; |
| 4864 |
redo B; |
next B; |
| 4865 |
} |
} |
| 4866 |
|
|
| 4867 |
## Clear back to table body context |
## Clear back to table body context |
| 4899 |
$self->{insertion_mode} = IN_COLUMN_GROUP_IM; |
$self->{insertion_mode} = IN_COLUMN_GROUP_IM; |
| 4900 |
## reprocess |
## reprocess |
| 4901 |
!!!ack-later; |
!!!ack-later; |
| 4902 |
redo B; |
next B; |
| 4903 |
} elsif ({ |
} elsif ({ |
| 4904 |
caption => 1, |
caption => 1, |
| 4905 |
colgroup => 1, |
colgroup => 1, |
| 4926 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
| 4927 |
!!!next-token; |
!!!next-token; |
| 4928 |
!!!nack ('t220.1'); |
!!!nack ('t220.1'); |
| 4929 |
redo B; |
next B; |
| 4930 |
} else { |
} else { |
| 4931 |
die "$0: in table: <>: $token->{tag_name}"; |
die "$0: in table: <>: $token->{tag_name}"; |
| 4932 |
} |
} |
| 4957 |
## Ignore tokens </table><table> |
## Ignore tokens </table><table> |
| 4958 |
!!!nack ('t223.1'); |
!!!nack ('t223.1'); |
| 4959 |
!!!next-token; |
!!!next-token; |
| 4960 |
redo B; |
next B; |
| 4961 |
} |
} |
| 4962 |
|
|
| 4963 |
## TODO: Followings are removed from the latest spec. |
## TODO: Followings are removed from the latest spec. |
| 4985 |
|
|
| 4986 |
## reprocess |
## reprocess |
| 4987 |
!!!ack-later; |
!!!ack-later; |
| 4988 |
redo B; |
next B; |
| 4989 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
| 4990 |
if (not $open_tables->[-1]->[1]) { # tainted |
if (not $open_tables->[-1]->[1]) { # tainted |
| 4991 |
!!!cp ('t227.8'); |
!!!cp ('t227.8'); |
| 4992 |
## NOTE: This is a "as if in head" code clone. |
## NOTE: This is a "as if in head" code clone. |
| 4993 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 4994 |
redo B; |
next B; |
| 4995 |
} else { |
} else { |
| 4996 |
!!!cp ('t227.7'); |
!!!cp ('t227.7'); |
| 4997 |
# |
# |
| 5001 |
!!!cp ('t227.6'); |
!!!cp ('t227.6'); |
| 5002 |
## NOTE: This is a "as if in head" code clone. |
## NOTE: This is a "as if in head" code clone. |
| 5003 |
$script_start_tag->(); |
$script_start_tag->(); |
| 5004 |
redo B; |
next B; |
| 5005 |
} else { |
} else { |
| 5006 |
!!!cp ('t227.5'); |
!!!cp ('t227.5'); |
| 5007 |
# |
# |
| 5022 |
|
|
| 5023 |
!!!next-token; |
!!!next-token; |
| 5024 |
!!!ack ('t227.2.1'); |
!!!ack ('t227.2.1'); |
| 5025 |
redo B; |
next B; |
| 5026 |
} else { |
} else { |
| 5027 |
!!!cp ('t227.2'); |
!!!cp ('t227.2'); |
| 5028 |
# |
# |
| 5066 |
## Ignore the token |
## Ignore the token |
| 5067 |
!!!nack ('t230.1'); |
!!!nack ('t230.1'); |
| 5068 |
!!!next-token; |
!!!next-token; |
| 5069 |
redo B; |
next B; |
| 5070 |
} else { |
} else { |
| 5071 |
!!!cp ('t232'); |
!!!cp ('t232'); |
| 5072 |
} |
} |
| 5083 |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
| 5084 |
!!!next-token; |
!!!next-token; |
| 5085 |
!!!nack ('t231.1'); |
!!!nack ('t231.1'); |
| 5086 |
redo B; |
next B; |
| 5087 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
| 5088 |
if ($self->{insertion_mode} == IN_ROW_IM) { |
if ($self->{insertion_mode} == IN_ROW_IM) { |
| 5089 |
## As if </tr> |
## As if </tr> |
| 5107 |
## Ignore the token |
## Ignore the token |
| 5108 |
!!!nack ('t236.1'); |
!!!nack ('t236.1'); |
| 5109 |
!!!next-token; |
!!!next-token; |
| 5110 |
redo B; |
next B; |
| 5111 |
} |
} |
| 5112 |
|
|
| 5113 |
## Clear back to table row context |
## Clear back to table row context |
| 5143 |
## Ignore the token |
## Ignore the token |
| 5144 |
!!!nack ('t239.1'); |
!!!nack ('t239.1'); |
| 5145 |
!!!next-token; |
!!!next-token; |
| 5146 |
redo B; |
next B; |
| 5147 |
} |
} |
| 5148 |
|
|
| 5149 |
## Clear back to table body context |
## Clear back to table body context |
| 5189 |
## Ignore the token |
## Ignore the token |
| 5190 |
!!!nack ('t243.1'); |
!!!nack ('t243.1'); |
| 5191 |
!!!next-token; |
!!!next-token; |
| 5192 |
redo B; |
next B; |
| 5193 |
} |
} |
| 5194 |
|
|
| 5195 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
| 5198 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
| 5199 |
|
|
| 5200 |
!!!next-token; |
!!!next-token; |
| 5201 |
redo B; |
next B; |
| 5202 |
} elsif ({ |
} elsif ({ |
| 5203 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
| 5204 |
}->{$token->{tag_name}} and |
}->{$token->{tag_name}} and |
| 5223 |
## Ignore the token |
## Ignore the token |
| 5224 |
!!!nack ('t249.1'); |
!!!nack ('t249.1'); |
| 5225 |
!!!next-token; |
!!!next-token; |
| 5226 |
redo B; |
next B; |
| 5227 |
} |
} |
| 5228 |
|
|
| 5229 |
## As if </tr> |
## As if </tr> |
| 5246 |
## Ignore the token |
## Ignore the token |
| 5247 |
!!!nack ('t252.1'); |
!!!nack ('t252.1'); |
| 5248 |
!!!next-token; |
!!!next-token; |
| 5249 |
redo B; |
next B; |
| 5250 |
} |
} |
| 5251 |
|
|
| 5252 |
## Clear back to table row context |
## Clear back to table row context |
| 5281 |
## Ignore the token |
## Ignore the token |
| 5282 |
!!!nack ('t256.1'); |
!!!nack ('t256.1'); |
| 5283 |
!!!next-token; |
!!!next-token; |
| 5284 |
redo B; |
next B; |
| 5285 |
} |
} |
| 5286 |
|
|
| 5287 |
## Clear back to table body context |
## Clear back to table body context |
| 5296 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5297 |
!!!nack ('t257.1'); |
!!!nack ('t257.1'); |
| 5298 |
!!!next-token; |
!!!next-token; |
| 5299 |
redo B; |
next B; |
| 5300 |
} elsif ({ |
} elsif ({ |
| 5301 |
body => 1, caption => 1, col => 1, colgroup => 1, |
body => 1, caption => 1, col => 1, colgroup => 1, |
| 5302 |
html => 1, td => 1, th => 1, |
html => 1, td => 1, th => 1, |
| 5308 |
## Ignore the token |
## Ignore the token |
| 5309 |
!!!nack ('t258.1'); |
!!!nack ('t258.1'); |
| 5310 |
!!!next-token; |
!!!next-token; |
| 5311 |
redo B; |
next B; |
| 5312 |
} else { |
} else { |
| 5313 |
!!!cp ('t259'); |
!!!cp ('t259'); |
| 5314 |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
| 5339 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 5340 |
!!!cp ('t260'); |
!!!cp ('t260'); |
| 5341 |
!!!next-token; |
!!!next-token; |
| 5342 |
redo B; |
next B; |
| 5343 |
} |
} |
| 5344 |
} |
} |
| 5345 |
|
|
| 5352 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5353 |
!!!ack ('t262.1'); |
!!!ack ('t262.1'); |
| 5354 |
!!!next-token; |
!!!next-token; |
| 5355 |
redo B; |
next B; |
| 5356 |
} else { |
} else { |
| 5357 |
!!!cp ('t263'); |
!!!cp ('t263'); |
| 5358 |
# |
# |
| 5364 |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
| 5365 |
## Ignore the token |
## Ignore the token |
| 5366 |
!!!next-token; |
!!!next-token; |
| 5367 |
redo B; |
next B; |
| 5368 |
} else { |
} else { |
| 5369 |
!!!cp ('t265'); |
!!!cp ('t265'); |
| 5370 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
| 5371 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5372 |
!!!next-token; |
!!!next-token; |
| 5373 |
redo B; |
next B; |
| 5374 |
} |
} |
| 5375 |
} elsif ($token->{tag_name} eq 'col') { |
} elsif ($token->{tag_name} eq 'col') { |
| 5376 |
!!!cp ('t266'); |
!!!cp ('t266'); |
| 5377 |
!!!parse-error (type => 'unmatched end tag:col', token => $token); |
!!!parse-error (type => 'unmatched end tag:col', token => $token); |
| 5378 |
## Ignore the token |
## Ignore the token |
| 5379 |
!!!next-token; |
!!!next-token; |
| 5380 |
redo B; |
next B; |
| 5381 |
} else { |
} else { |
| 5382 |
!!!cp ('t267'); |
!!!cp ('t267'); |
| 5383 |
# |
# |
| 5394 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
| 5395 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5396 |
## Reprocess. |
## Reprocess. |
| 5397 |
redo B; |
next B; |
| 5398 |
} |
} |
| 5399 |
} else { |
} else { |
| 5400 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 5408 |
## Ignore the token |
## Ignore the token |
| 5409 |
!!!nack ('t269.1'); |
!!!nack ('t269.1'); |
| 5410 |
!!!next-token; |
!!!next-token; |
| 5411 |
redo B; |
next B; |
| 5412 |
} else { |
} else { |
| 5413 |
!!!cp ('t270'); |
!!!cp ('t270'); |
| 5414 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
| 5415 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5416 |
!!!ack-later; |
!!!ack-later; |
| 5417 |
## reprocess |
## reprocess |
| 5418 |
redo B; |
next B; |
| 5419 |
} |
} |
| 5420 |
} elsif ($self->{insertion_mode} & SELECT_IMS) { |
} elsif ($self->{insertion_mode} & SELECT_IMS) { |
| 5421 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 5422 |
!!!cp ('t271'); |
!!!cp ('t271'); |
| 5423 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 5424 |
!!!next-token; |
!!!next-token; |
| 5425 |
redo B; |
next B; |
| 5426 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 5427 |
if ($token->{tag_name} eq 'option') { |
if ($token->{tag_name} eq 'option') { |
| 5428 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
| 5436 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 5437 |
!!!nack ('t273.1'); |
!!!nack ('t273.1'); |
| 5438 |
!!!next-token; |
!!!next-token; |
| 5439 |
redo B; |
next B; |
| 5440 |
} elsif ($token->{tag_name} eq 'optgroup') { |
} elsif ($token->{tag_name} eq 'optgroup') { |
| 5441 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
| 5442 |
!!!cp ('t274'); |
!!!cp ('t274'); |
| 5457 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 5458 |
!!!nack ('t277.1'); |
!!!nack ('t277.1'); |
| 5459 |
!!!next-token; |
!!!next-token; |
| 5460 |
redo B; |
next B; |
| 5461 |
} elsif ($token->{tag_name} eq 'select' or |
} elsif ($token->{tag_name} eq 'select' or |
| 5462 |
$token->{tag_name} eq 'input' or |
$token->{tag_name} eq 'input' or |
| 5463 |
($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
| 5489 |
## Ignore the token |
## Ignore the token |
| 5490 |
!!!nack ('t280.1'); |
!!!nack ('t280.1'); |
| 5491 |
!!!next-token; |
!!!next-token; |
| 5492 |
redo B; |
next B; |
| 5493 |
} |
} |
| 5494 |
|
|
| 5495 |
!!!cp ('t281'); |
!!!cp ('t281'); |
| 5500 |
if ($token->{tag_name} eq 'select') { |
if ($token->{tag_name} eq 'select') { |
| 5501 |
!!!nack ('t281.2'); |
!!!nack ('t281.2'); |
| 5502 |
!!!next-token; |
!!!next-token; |
| 5503 |
redo B; |
next B; |
| 5504 |
} else { |
} else { |
| 5505 |
!!!cp ('t281.1'); |
!!!cp ('t281.1'); |
| 5506 |
!!!ack-later; |
!!!ack-later; |
| 5507 |
## Reprocess the token. |
## Reprocess the token. |
| 5508 |
redo B; |
next B; |
| 5509 |
} |
} |
| 5510 |
} else { |
} else { |
| 5511 |
!!!cp ('t282'); |
!!!cp ('t282'); |
| 5513 |
## Ignore the token |
## Ignore the token |
| 5514 |
!!!nack ('t282.1'); |
!!!nack ('t282.1'); |
| 5515 |
!!!next-token; |
!!!next-token; |
| 5516 |
redo B; |
next B; |
| 5517 |
} |
} |
| 5518 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 5519 |
if ($token->{tag_name} eq 'optgroup') { |
if ($token->{tag_name} eq 'optgroup') { |
| 5532 |
} |
} |
| 5533 |
!!!nack ('t285.1'); |
!!!nack ('t285.1'); |
| 5534 |
!!!next-token; |
!!!next-token; |
| 5535 |
redo B; |
next B; |
| 5536 |
} elsif ($token->{tag_name} eq 'option') { |
} elsif ($token->{tag_name} eq 'option') { |
| 5537 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
| 5538 |
!!!cp ('t286'); |
!!!cp ('t286'); |
| 5544 |
} |
} |
| 5545 |
!!!nack ('t287.1'); |
!!!nack ('t287.1'); |
| 5546 |
!!!next-token; |
!!!next-token; |
| 5547 |
redo B; |
next B; |
| 5548 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
| 5549 |
## have an element in table scope |
## have an element in table scope |
| 5550 |
my $i; |
my $i; |
| 5565 |
## Ignore the token |
## Ignore the token |
| 5566 |
!!!nack ('t290.1'); |
!!!nack ('t290.1'); |
| 5567 |
!!!next-token; |
!!!next-token; |
| 5568 |
redo B; |
next B; |
| 5569 |
} |
} |
| 5570 |
|
|
| 5571 |
!!!cp ('t291'); |
!!!cp ('t291'); |
| 5575 |
|
|
| 5576 |
!!!nack ('t291.1'); |
!!!nack ('t291.1'); |
| 5577 |
!!!next-token; |
!!!next-token; |
| 5578 |
redo B; |
next B; |
| 5579 |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
| 5580 |
{ |
{ |
| 5581 |
caption => 1, table => 1, tbody => 1, |
caption => 1, table => 1, tbody => 1, |
| 5602 |
## Ignore the token |
## Ignore the token |
| 5603 |
!!!nack ('t294.1'); |
!!!nack ('t294.1'); |
| 5604 |
!!!next-token; |
!!!next-token; |
| 5605 |
redo B; |
next B; |
| 5606 |
} |
} |
| 5607 |
|
|
| 5608 |
## As if </select> |
## As if </select> |
| 5627 |
## Ignore the </select> token |
## Ignore the </select> token |
| 5628 |
!!!nack ('t297.1'); |
!!!nack ('t297.1'); |
| 5629 |
!!!next-token; ## TODO: ok? |
!!!next-token; ## TODO: ok? |
| 5630 |
redo B; |
next B; |
| 5631 |
} |
} |
| 5632 |
|
|
| 5633 |
!!!cp ('t298'); |
!!!cp ('t298'); |
| 5637 |
|
|
| 5638 |
!!!ack-later; |
!!!ack-later; |
| 5639 |
## reprocess |
## reprocess |
| 5640 |
redo B; |
next B; |
| 5641 |
} else { |
} else { |
| 5642 |
!!!cp ('t299'); |
!!!cp ('t299'); |
| 5643 |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
| 5644 |
## Ignore the token |
## Ignore the token |
| 5645 |
!!!nack ('t299.3'); |
!!!nack ('t299.3'); |
| 5646 |
!!!next-token; |
!!!next-token; |
| 5647 |
redo B; |
next B; |
| 5648 |
} |
} |
| 5649 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5650 |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
| 5672 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 5673 |
!!!cp ('t300'); |
!!!cp ('t300'); |
| 5674 |
!!!next-token; |
!!!next-token; |
| 5675 |
redo B; |
next B; |
| 5676 |
} |
} |
| 5677 |
} |
} |
| 5678 |
|
|
| 5690 |
|
|
| 5691 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 5692 |
## reprocess |
## reprocess |
| 5693 |
redo B; |
next B; |
| 5694 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 5695 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
| 5696 |
!!!cp ('t303'); |
!!!cp ('t303'); |
| 5707 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 5708 |
!!!ack-later; |
!!!ack-later; |
| 5709 |
## reprocess |
## reprocess |
| 5710 |
redo B; |
next B; |
| 5711 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 5712 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
| 5713 |
!!!cp ('t305'); |
!!!cp ('t305'); |
| 5726 |
!!!parse-error (type => 'unmatched end tag:html', token => $token); |
!!!parse-error (type => 'unmatched end tag:html', token => $token); |
| 5727 |
## Ignore the token |
## Ignore the token |
| 5728 |
!!!next-token; |
!!!next-token; |
| 5729 |
redo B; |
next B; |
| 5730 |
} else { |
} else { |
| 5731 |
!!!cp ('t308'); |
!!!cp ('t308'); |
| 5732 |
$self->{insertion_mode} = AFTER_HTML_BODY_IM; |
$self->{insertion_mode} = AFTER_HTML_BODY_IM; |
| 5733 |
!!!next-token; |
!!!next-token; |
| 5734 |
redo B; |
next B; |
| 5735 |
} |
} |
| 5736 |
} else { |
} else { |
| 5737 |
!!!cp ('t309'); |
!!!cp ('t309'); |
| 5739 |
|
|
| 5740 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 5741 |
## reprocess |
## reprocess |
| 5742 |
redo B; |
next B; |
| 5743 |
} |
} |
| 5744 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5745 |
!!!cp ('t309.2'); |
!!!cp ('t309.2'); |
| 5756 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 5757 |
!!!cp ('t310'); |
!!!cp ('t310'); |
| 5758 |
!!!next-token; |
!!!next-token; |
| 5759 |
redo B; |
next B; |
| 5760 |
} |
} |
| 5761 |
} |
} |
| 5762 |
|
|
| 5784 |
!!!cp ('t315'); |
!!!cp ('t315'); |
| 5785 |
!!!next-token; |
!!!next-token; |
| 5786 |
} |
} |
| 5787 |
redo B; |
next B; |
| 5788 |
} |
} |
| 5789 |
|
|
| 5790 |
die qq[$0: Character "$token->{data}"]; |
die qq[$0: Character "$token->{data}"]; |
| 5805 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 5806 |
!!!nack ('t318.1'); |
!!!nack ('t318.1'); |
| 5807 |
!!!next-token; |
!!!next-token; |
| 5808 |
redo B; |
next B; |
| 5809 |
} elsif ($token->{tag_name} eq 'frame' and |
} elsif ($token->{tag_name} eq 'frame' and |
| 5810 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
| 5811 |
!!!cp ('t319'); |
!!!cp ('t319'); |
| 5813 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5814 |
!!!ack ('t319.1'); |
!!!ack ('t319.1'); |
| 5815 |
!!!next-token; |
!!!next-token; |
| 5816 |
redo B; |
next B; |
| 5817 |
} elsif ($token->{tag_name} eq 'noframes') { |
} elsif ($token->{tag_name} eq 'noframes') { |
| 5818 |
!!!cp ('t320'); |
!!!cp ('t320'); |
| 5819 |
## NOTE: As if in body. |
## NOTE: As if in body. |
| 5820 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 5821 |
redo B; |
next B; |
| 5822 |
} else { |
} else { |
| 5823 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
| 5824 |
!!!cp ('t321'); |
!!!cp ('t321'); |
| 5830 |
## Ignore the token |
## Ignore the token |
| 5831 |
!!!nack ('t322.1'); |
!!!nack ('t322.1'); |
| 5832 |
!!!next-token; |
!!!next-token; |
| 5833 |
redo B; |
next B; |
| 5834 |
} |
} |
| 5835 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 5836 |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
| 5864 |
} else { |
} else { |
| 5865 |
!!!cp ('t328'); |
!!!cp ('t328'); |
| 5866 |
} |
} |
| 5867 |
redo B; |
next B; |
| 5868 |
} elsif ($token->{tag_name} eq 'html' and |
} elsif ($token->{tag_name} eq 'html' and |
| 5869 |
$self->{insertion_mode} == AFTER_FRAMESET_IM) { |
$self->{insertion_mode} == AFTER_FRAMESET_IM) { |
| 5870 |
!!!cp ('t329'); |
!!!cp ('t329'); |
| 5871 |
$self->{insertion_mode} = AFTER_HTML_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_HTML_FRAMESET_IM; |
| 5872 |
!!!next-token; |
!!!next-token; |
| 5873 |
redo B; |
next B; |
| 5874 |
} else { |
} else { |
| 5875 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
| 5876 |
!!!cp ('t330'); |
!!!cp ('t330'); |
| 5881 |
} |
} |
| 5882 |
## Ignore the token |
## Ignore the token |
| 5883 |
!!!next-token; |
!!!next-token; |
| 5884 |
redo B; |
next B; |
| 5885 |
} |
} |
| 5886 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5887 |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
| 5909 |
!!!cp ('t332'); |
!!!cp ('t332'); |
| 5910 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
| 5911 |
$script_start_tag->(); |
$script_start_tag->(); |
| 5912 |
redo B; |
next B; |
| 5913 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
| 5914 |
!!!cp ('t333'); |
!!!cp ('t333'); |
| 5915 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
| 5916 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 5917 |
redo B; |
next B; |
| 5918 |
} elsif ({ |
} elsif ({ |
| 5919 |
base => 1, link => 1, |
base => 1, link => 1, |
| 5920 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5924 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
| 5925 |
!!!ack ('t334.1'); |
!!!ack ('t334.1'); |
| 5926 |
!!!next-token; |
!!!next-token; |
| 5927 |
redo B; |
next B; |
| 5928 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
| 5929 |
## NOTE: This is an "as if in head" code clone, only "-t" differs |
## NOTE: This is an "as if in head" code clone, only "-t" differs |
| 5930 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 5975 |
|
|
| 5976 |
!!!ack ('t338.1'); |
!!!ack ('t338.1'); |
| 5977 |
!!!next-token; |
!!!next-token; |
| 5978 |
redo B; |
next B; |
| 5979 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
| 5980 |
!!!cp ('t341'); |
!!!cp ('t341'); |
| 5981 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
| 5982 |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
| 5983 |
redo B; |
next B; |
| 5984 |
} elsif ($token->{tag_name} eq 'body') { |
} elsif ($token->{tag_name} eq 'body') { |
| 5985 |
!!!parse-error (type => 'in body:body', token => $token); |
!!!parse-error (type => 'in body:body', token => $token); |
| 5986 |
|
|
| 6001 |
} |
} |
| 6002 |
!!!nack ('t343.1'); |
!!!nack ('t343.1'); |
| 6003 |
!!!next-token; |
!!!next-token; |
| 6004 |
redo B; |
next B; |
| 6005 |
} elsif ({ |
} elsif ({ |
| 6006 |
address => 1, blockquote => 1, center => 1, dir => 1, |
address => 1, blockquote => 1, center => 1, dir => 1, |
| 6007 |
div => 1, dl => 1, fieldset => 1, |
div => 1, dl => 1, fieldset => 1, |
| 6018 |
## Ignore the token |
## Ignore the token |
| 6019 |
!!!nack ('t350.1'); |
!!!nack ('t350.1'); |
| 6020 |
!!!next-token; |
!!!next-token; |
| 6021 |
redo B; |
next B; |
| 6022 |
} |
} |
| 6023 |
|
|
| 6024 |
## has a p element in scope |
## has a p element in scope |
| 6028 |
!!!back-token; # <form> |
!!!back-token; # <form> |
| 6029 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
| 6030 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6031 |
redo B; |
next B; |
| 6032 |
} elsif ($_->[1] & SCOPING_EL) { |
} elsif ($_->[1] & SCOPING_EL) { |
| 6033 |
!!!cp ('t345'); |
!!!cp ('t345'); |
| 6034 |
last INSCOPE; |
last INSCOPE; |
| 6074 |
!!!nack ('t347.1'); |
!!!nack ('t347.1'); |
| 6075 |
!!!next-token; |
!!!next-token; |
| 6076 |
} |
} |
| 6077 |
redo B; |
next B; |
| 6078 |
} elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) { |
} elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) { |
| 6079 |
## has a p element in scope |
## has a p element in scope |
| 6080 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 6083 |
!!!back-token; # <x> |
!!!back-token; # <x> |
| 6084 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
| 6085 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6086 |
redo B; |
next B; |
| 6087 |
} elsif ($_->[1] & SCOPING_EL) { |
} elsif ($_->[1] & SCOPING_EL) { |
| 6088 |
!!!cp ('t354'); |
!!!cp ('t354'); |
| 6089 |
last INSCOPE; |
last INSCOPE; |
| 6135 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 6136 |
!!!nack ('t359.1'); |
!!!nack ('t359.1'); |
| 6137 |
!!!next-token; |
!!!next-token; |
| 6138 |
redo B; |
next B; |
| 6139 |
} elsif ($token->{tag_name} eq 'plaintext') { |
} elsif ($token->{tag_name} eq 'plaintext') { |
| 6140 |
## has a p element in scope |
## has a p element in scope |
| 6141 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 6144 |
!!!back-token; # <plaintext> |
!!!back-token; # <plaintext> |
| 6145 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
| 6146 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6147 |
redo B; |
next B; |
| 6148 |
} elsif ($_->[1] & SCOPING_EL) { |
} elsif ($_->[1] & SCOPING_EL) { |
| 6149 |
!!!cp ('t368'); |
!!!cp ('t368'); |
| 6150 |
last INSCOPE; |
last INSCOPE; |
| 6157 |
|
|
| 6158 |
!!!nack ('t368.1'); |
!!!nack ('t368.1'); |
| 6159 |
!!!next-token; |
!!!next-token; |
| 6160 |
redo B; |
next B; |
| 6161 |
} elsif ($token->{tag_name} eq 'a') { |
} elsif ($token->{tag_name} eq 'a') { |
| 6162 |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
| 6163 |
my $node = $active_formatting_elements->[$i]; |
my $node = $active_formatting_elements->[$i]; |
| 6198 |
|
|
| 6199 |
!!!nack ('t374.1'); |
!!!nack ('t374.1'); |
| 6200 |
!!!next-token; |
!!!next-token; |
| 6201 |
redo B; |
next B; |
| 6202 |
} elsif ($token->{tag_name} eq 'nobr') { |
} elsif ($token->{tag_name} eq 'nobr') { |
| 6203 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 6204 |
|
|
| 6211 |
!!!back-token; # <nobr> |
!!!back-token; # <nobr> |
| 6212 |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
| 6213 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6214 |
redo B; |
next B; |
| 6215 |
} elsif ($node->[1] & SCOPING_EL) { |
} elsif ($node->[1] & SCOPING_EL) { |
| 6216 |
!!!cp ('t377'); |
!!!cp ('t377'); |
| 6217 |
last INSCOPE; |
last INSCOPE; |
| 6223 |
|
|
| 6224 |
!!!nack ('t377.1'); |
!!!nack ('t377.1'); |
| 6225 |
!!!next-token; |
!!!next-token; |
| 6226 |
redo B; |
next B; |
| 6227 |
} elsif ($token->{tag_name} eq 'button') { |
} elsif ($token->{tag_name} eq 'button') { |
| 6228 |
## has a button element in scope |
## has a button element in scope |
| 6229 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 6234 |
!!!back-token; # <button> |
!!!back-token; # <button> |
| 6235 |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
| 6236 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6237 |
redo B; |
next B; |
| 6238 |
} elsif ($node->[1] & SCOPING_EL) { |
} elsif ($node->[1] & SCOPING_EL) { |
| 6239 |
!!!cp ('t379'); |
!!!cp ('t379'); |
| 6240 |
last INSCOPE; |
last INSCOPE; |
| 6251 |
|
|
| 6252 |
!!!nack ('t379.1'); |
!!!nack ('t379.1'); |
| 6253 |
!!!next-token; |
!!!next-token; |
| 6254 |
redo B; |
next B; |
| 6255 |
} elsif ({ |
} elsif ({ |
| 6256 |
xmp => 1, |
xmp => 1, |
| 6257 |
iframe => 1, |
iframe => 1, |
| 6267 |
} |
} |
| 6268 |
## NOTE: There is an "as if in body" code clone. |
## NOTE: There is an "as if in body" code clone. |
| 6269 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 6270 |
redo B; |
next B; |
| 6271 |
} elsif ($token->{tag_name} eq 'isindex') { |
} elsif ($token->{tag_name} eq 'isindex') { |
| 6272 |
!!!parse-error (type => 'isindex', token => $token); |
!!!parse-error (type => 'isindex', token => $token); |
| 6273 |
|
|
| 6276 |
## Ignore the token |
## Ignore the token |
| 6277 |
!!!nack ('t389'); ## NOTE: Not acknowledged. |
!!!nack ('t389'); ## NOTE: Not acknowledged. |
| 6278 |
!!!next-token; |
!!!next-token; |
| 6279 |
redo B; |
next B; |
| 6280 |
} else { |
} else { |
| 6281 |
my $at = $token->{attributes}; |
my $at = $token->{attributes}; |
| 6282 |
my $form_attrs; |
my $form_attrs; |
| 6324 |
!!!nack ('t391.1'); ## NOTE: Not acknowledged. |
!!!nack ('t391.1'); ## NOTE: Not acknowledged. |
| 6325 |
!!!back-token (@tokens); |
!!!back-token (@tokens); |
| 6326 |
!!!next-token; |
!!!next-token; |
| 6327 |
redo B; |
next B; |
| 6328 |
} |
} |
| 6329 |
} elsif ($token->{tag_name} eq 'textarea') { |
} elsif ($token->{tag_name} eq 'textarea') { |
| 6330 |
my $tag_name = $token->{tag_name}; |
my $tag_name = $token->{tag_name}; |
| 6331 |
my $el; |
my $el; |
| 6332 |
!!!create-element ($el, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($el, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
| 6333 |
|
|
| 6334 |
## TODO: $self->{form_element} if defined |
## TODO: $self->{form_element} if defined |
| 6335 |
$self->{content_model} = RCDATA_CONTENT_MODEL; |
$self->{content_model} = RCDATA_CONTENT_MODEL; |
| 6372 |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}, token => $token); |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}, token => $token); |
| 6373 |
} |
} |
| 6374 |
!!!next-token; |
!!!next-token; |
| 6375 |
redo B; |
next B; |
| 6376 |
|
} elsif ($token->{tag_name} eq 'math' or |
| 6377 |
|
$token->{tag_name} eq 'svg') { |
| 6378 |
|
$reconstruct_active_formatting_elements->($insert_to_current); |
| 6379 |
|
|
| 6380 |
|
!!!insert-element-f ($token->{tag_name} eq 'math' ? $MML_NS : $SVG_NS, $token); |
| 6381 |
|
|
| 6382 |
|
if ($self->{self_closing}) { |
| 6383 |
|
pop @{$self->{open_elements}}; |
| 6384 |
|
!!!ack ('t398.1'); |
| 6385 |
|
} else { |
| 6386 |
|
!!!cp ('t398.2'); |
| 6387 |
|
$self->{insertion_mode} |= IN_FOREIGN_CONTENT_IM; |
| 6388 |
|
## NOTE: |<body><math><mi><svg>| -> "in foreign content" insertion |
| 6389 |
|
## mode, "in body" (not "in foreign content") secondary insertion |
| 6390 |
|
## mode, maybe. |
| 6391 |
|
} |
| 6392 |
|
|
| 6393 |
|
!!!next-token; |
| 6394 |
|
next B; |
| 6395 |
} elsif ({ |
} elsif ({ |
| 6396 |
caption => 1, col => 1, colgroup => 1, frame => 1, |
caption => 1, col => 1, colgroup => 1, frame => 1, |
| 6397 |
frameset => 1, head => 1, option => 1, optgroup => 1, |
frameset => 1, head => 1, option => 1, optgroup => 1, |
| 6403 |
## Ignore the token |
## Ignore the token |
| 6404 |
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
| 6405 |
!!!next-token; |
!!!next-token; |
| 6406 |
redo B; |
next B; |
| 6407 |
|
|
| 6408 |
## ISSUE: An issue on HTML5 new elements in the spec. |
## ISSUE: An issue on HTML5 new elements in the spec. |
| 6409 |
} else { |
} else { |
| 6465 |
} |
} |
| 6466 |
|
|
| 6467 |
!!!next-token; |
!!!next-token; |
| 6468 |
redo B; |
next B; |
| 6469 |
} |
} |
| 6470 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 6471 |
if ($token->{tag_name} eq 'body') { |
if ($token->{tag_name} eq 'body') { |
| 6487 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
| 6488 |
## NOTE: Ignore the token. |
## NOTE: Ignore the token. |
| 6489 |
!!!next-token; |
!!!next-token; |
| 6490 |
redo B; |
next B; |
| 6491 |
} # INSCOPE |
} # INSCOPE |
| 6492 |
|
|
| 6493 |
for (@{$self->{open_elements}}) { |
for (@{$self->{open_elements}}) { |
| 6504 |
|
|
| 6505 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
| 6506 |
!!!next-token; |
!!!next-token; |
| 6507 |
redo B; |
next B; |
| 6508 |
} elsif ($token->{tag_name} eq 'html') { |
} elsif ($token->{tag_name} eq 'html') { |
| 6509 |
## TODO: Update this code. It seems that the code below is not |
## TODO: Update this code. It seems that the code below is not |
| 6510 |
## up-to-date, though it has same effect as speced. |
## up-to-date, though it has same effect as speced. |
| 6522 |
} |
} |
| 6523 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
| 6524 |
## reprocess |
## reprocess |
| 6525 |
redo B; |
next B; |
| 6526 |
} else { |
} else { |
| 6527 |
!!!cp ('t408'); |
!!!cp ('t408'); |
| 6528 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 6529 |
## Ignore the token |
## Ignore the token |
| 6530 |
!!!next-token; |
!!!next-token; |
| 6531 |
redo B; |
next B; |
| 6532 |
} |
} |
| 6533 |
} elsif ({ |
} elsif ({ |
| 6534 |
address => 1, blockquote => 1, center => 1, dir => 1, |
address => 1, blockquote => 1, center => 1, dir => 1, |
| 6588 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
| 6589 |
} |
} |
| 6590 |
!!!next-token; |
!!!next-token; |
| 6591 |
redo B; |
next B; |
| 6592 |
} elsif ($token->{tag_name} eq 'form') { |
} elsif ($token->{tag_name} eq 'form') { |
| 6593 |
undef $self->{form_element}; |
undef $self->{form_element}; |
| 6594 |
|
|
| 6633 |
} |
} |
| 6634 |
|
|
| 6635 |
!!!next-token; |
!!!next-token; |
| 6636 |
redo B; |
next B; |
| 6637 |
} elsif ({ |
} elsif ({ |
| 6638 |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
| 6639 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6675 |
} |
} |
| 6676 |
|
|
| 6677 |
!!!next-token; |
!!!next-token; |
| 6678 |
redo B; |
next B; |
| 6679 |
} elsif ($token->{tag_name} eq 'p') { |
} elsif ($token->{tag_name} eq 'p') { |
| 6680 |
## has an element in scope |
## has an element in scope |
| 6681 |
my $i; |
my $i; |
| 6711 |
!!!cp ('t415.1'); |
!!!cp ('t415.1'); |
| 6712 |
## As if <p>, then reprocess the current token |
## As if <p>, then reprocess the current token |
| 6713 |
my $el; |
my $el; |
| 6714 |
!!!create-element ($el, 'p',, $token); |
!!!create-element ($el, $HTML_NS, 'p',, $token); |
| 6715 |
$insert->($el); |
$insert->($el); |
| 6716 |
## NOTE: Not inserted into |$self->{open_elements}|. |
## NOTE: Not inserted into |$self->{open_elements}|. |
| 6717 |
} |
} |
| 6718 |
|
|
| 6719 |
!!!next-token; |
!!!next-token; |
| 6720 |
redo B; |
next B; |
| 6721 |
} elsif ({ |
} elsif ({ |
| 6722 |
a => 1, |
a => 1, |
| 6723 |
b => 1, big => 1, em => 1, font => 1, i => 1, |
b => 1, big => 1, em => 1, font => 1, i => 1, |
| 6726 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6727 |
!!!cp ('t427'); |
!!!cp ('t427'); |
| 6728 |
$formatting_end_tag->($token); |
$formatting_end_tag->($token); |
| 6729 |
redo B; |
next B; |
| 6730 |
} elsif ($token->{tag_name} eq 'br') { |
} elsif ($token->{tag_name} eq 'br') { |
| 6731 |
!!!cp ('t428'); |
!!!cp ('t428'); |
| 6732 |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
| 6735 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 6736 |
|
|
| 6737 |
my $el; |
my $el; |
| 6738 |
!!!create-element ($el, 'br',, $token); |
!!!create-element ($el, $HTML_NS, 'br',, $token); |
| 6739 |
$insert->($el); |
$insert->($el); |
| 6740 |
|
|
| 6741 |
## Ignore the token. |
## Ignore the token. |
| 6742 |
!!!next-token; |
!!!next-token; |
| 6743 |
redo B; |
next B; |
| 6744 |
} elsif ({ |
} elsif ({ |
| 6745 |
caption => 1, col => 1, colgroup => 1, frame => 1, |
caption => 1, col => 1, colgroup => 1, frame => 1, |
| 6746 |
frameset => 1, head => 1, option => 1, optgroup => 1, |
frameset => 1, head => 1, option => 1, optgroup => 1, |
| 6757 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 6758 |
## Ignore the token |
## Ignore the token |
| 6759 |
!!!next-token; |
!!!next-token; |
| 6760 |
redo B; |
next B; |
| 6761 |
|
|
| 6762 |
## ISSUE: Issue on HTML5 new elements in spec |
## ISSUE: Issue on HTML5 new elements in spec |
| 6763 |
|
|
| 6818 |
## Step 5; |
## Step 5; |
| 6819 |
redo S2; |
redo S2; |
| 6820 |
} # S2 |
} # S2 |
| 6821 |
redo B; |
next B; |
| 6822 |
} |
} |
| 6823 |
} |
} |
| 6824 |
redo B; |
next B; |
| 6825 |
|
} continue { # B |
| 6826 |
|
if ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM) { |
| 6827 |
|
## NOTE: The code below is executed in cases where it does not have |
| 6828 |
|
## to be, but it it is harmless even in those cases. |
| 6829 |
|
## has an element in scope |
| 6830 |
|
INSCOPE: { |
| 6831 |
|
for (reverse 0..$#{$self->{open_elements}}) { |
| 6832 |
|
my $node = $self->{open_elements}->[$_]; |
| 6833 |
|
if ($node->[1] & FOREIGN_EL) { |
| 6834 |
|
last INSCOPE; |
| 6835 |
|
} elsif ($node->[1] & SCOPING_EL) { |
| 6836 |
|
last; |
| 6837 |
|
} |
| 6838 |
|
} |
| 6839 |
|
|
| 6840 |
|
## NOTE: No foreign element in scope. |
| 6841 |
|
$self->{insertion_mode} &= ~ IN_FOREIGN_CONTENT_IM; |
| 6842 |
|
} # INSCOPE |
| 6843 |
|
} |
| 6844 |
} # B |
} # B |
| 6845 |
|
|
| 6846 |
## Stop parsing # MUST |
## Stop parsing # MUST |