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, |
477 |
sub BODY_AFTER_IMS () { 0b100000000 } |
sub BODY_AFTER_IMS () { 0b100000000 } |
478 |
sub FRAME_IMS () { 0b1000000000 } |
sub FRAME_IMS () { 0b1000000000 } |
479 |
sub SELECT_IMS () { 0b10000000000 } |
sub SELECT_IMS () { 0b10000000000 } |
480 |
|
sub IN_FOREIGN_CONTENT_IM () { 0b100000000000 } |
481 |
|
## NOTE: "in foreign content" insertion mode is special; it is combined |
482 |
|
## with the secondary insertion mode. In this parser, they are stored |
483 |
|
## together in the bit-or'ed form. |
484 |
|
|
485 |
## NOTE: "initial" and "before html" insertion modes have no constants. |
## NOTE: "initial" and "before html" insertion modes have no constants. |
486 |
|
|
2920 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
2921 |
if ($token->{tag_name} eq 'html') { |
if ($token->{tag_name} eq 'html') { |
2922 |
my $root_element; |
my $root_element; |
2923 |
!!!create-element ($root_element, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($root_element, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
2924 |
$self->{document}->append_child ($root_element); |
$self->{document}->append_child ($root_element); |
2925 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
2926 |
[$root_element, $el_category->{html}]; |
[$root_element, $el_category->{html}]; |
2956 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
2957 |
} |
} |
2958 |
|
|
2959 |
my $root_element; !!!create-element ($root_element, 'html',, $token); |
my $root_element; |
2960 |
|
!!!create-element ($root_element, $HTML_NS, 'html',, $token); |
2961 |
$self->{document}->append_child ($root_element); |
$self->{document}->append_child ($root_element); |
2962 |
push @{$self->{open_elements}}, [$root_element, $el_category->{html}]; |
push @{$self->{open_elements}}, [$root_element, $el_category->{html}]; |
2963 |
|
|
2998 |
} |
} |
2999 |
} |
} |
3000 |
|
|
3001 |
## Step 4..13 |
## Step 4..14 |
3002 |
my $new_mode = { |
my $new_mode; |
3003 |
|
if ($node->[1] & FOREIGN_EL) { |
3004 |
|
## NOTE: Strictly spaking, the line below only applies to MathML and |
3005 |
|
## SVG elements. Currently the HTML syntax supports only MathML and |
3006 |
|
## SVG elements as foreigners. |
3007 |
|
$new_mode = $self->{insertion_mode} | IN_FOREIGN_CONTENT_IM; |
3008 |
|
## ISSUE: What is set as the secondary insertion mode? |
3009 |
|
} else { |
3010 |
|
$new_mode = { |
3011 |
select => IN_SELECT_IM, |
select => IN_SELECT_IM, |
3012 |
## NOTE: |option| and |optgroup| do not set |
## NOTE: |option| and |optgroup| do not set |
3013 |
## insertion mode to "in select" by themselves. |
## insertion mode to "in select" by themselves. |
3024 |
body => IN_BODY_IM, |
body => IN_BODY_IM, |
3025 |
frameset => IN_FRAMESET_IM, |
frameset => IN_FRAMESET_IM, |
3026 |
}->{$node->[0]->manakai_local_name}; |
}->{$node->[0]->manakai_local_name}; |
3027 |
## TODO: Foreign namespace case OK? |
} |
3028 |
$self->{insertion_mode} = $new_mode and return if defined $new_mode; |
$self->{insertion_mode} = $new_mode and return if defined $new_mode; |
3029 |
|
|
3030 |
## Step 14 |
## Step 15 |
3031 |
if ($node->[1] & HTML_EL) { |
if ($node->[1] & HTML_EL) { |
3032 |
unless (defined $self->{head_element}) { |
unless (defined $self->{head_element}) { |
3033 |
!!!cp ('t29'); |
!!!cp ('t29'); |
3042 |
!!!cp ('t31'); |
!!!cp ('t31'); |
3043 |
} |
} |
3044 |
|
|
3045 |
## Step 15 |
## Step 16 |
3046 |
$self->{insertion_mode} = IN_BODY_IM and return if $last; |
$self->{insertion_mode} = IN_BODY_IM and return if $last; |
3047 |
|
|
3048 |
## Step 16 |
## Step 17 |
3049 |
$i--; |
$i--; |
3050 |
$node = $self->{open_elements}->[$i]; |
$node = $self->{open_elements}->[$i]; |
3051 |
|
|
3052 |
## Step 17 |
## Step 18 |
3053 |
redo S3; |
redo S3; |
3054 |
} # S3 |
} # S3 |
3055 |
|
|
3161 |
## Step 1 |
## Step 1 |
3162 |
my $start_tag_name = $token->{tag_name}; |
my $start_tag_name = $token->{tag_name}; |
3163 |
my $el; |
my $el; |
3164 |
!!!create-element ($el, $start_tag_name, $token->{attributes}, $token); |
!!!create-element ($el, $HTML_NS, $start_tag_name, $token->{attributes}, $token); |
3165 |
|
|
3166 |
## Step 2 |
## Step 2 |
3167 |
$insert->($el); |
$insert->($el); |
3212 |
|
|
3213 |
my $script_start_tag = sub () { |
my $script_start_tag = sub () { |
3214 |
my $script_el; |
my $script_el; |
3215 |
!!!create-element ($script_el, 'script', $token->{attributes}, $token); |
!!!create-element ($script_el, $HTML_NS, 'script', $token->{attributes}, $token); |
3216 |
## TODO: mark as "parser-inserted" |
## TODO: mark as "parser-inserted" |
3217 |
|
|
3218 |
$self->{content_model} = CDATA_CONTENT_MODEL; |
$self->{content_model} = CDATA_CONTENT_MODEL; |
3535 |
} |
} |
3536 |
}; # $insert_to_foster |
}; # $insert_to_foster |
3537 |
|
|
3538 |
B: { |
B: while (1) { |
3539 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
3540 |
!!!cp ('t73'); |
!!!cp ('t73'); |
3541 |
!!!parse-error (type => 'DOCTYPE in the middle', token => $token); |
!!!parse-error (type => 'DOCTYPE in the middle', token => $token); |
3542 |
## Ignore the token |
## Ignore the token |
3543 |
## Stay in the phase |
## Stay in the phase |
3544 |
!!!next-token; |
!!!next-token; |
3545 |
redo B; |
next B; |
3546 |
} elsif ($token->{type} == START_TAG_TOKEN and |
} elsif ($token->{type} == START_TAG_TOKEN and |
3547 |
$token->{tag_name} eq 'html') { |
$token->{tag_name} eq 'html') { |
3548 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
3570 |
} |
} |
3571 |
!!!nack ('t84.1'); |
!!!nack ('t84.1'); |
3572 |
!!!next-token; |
!!!next-token; |
3573 |
redo B; |
next B; |
3574 |
} elsif ($token->{type} == COMMENT_TOKEN) { |
} elsif ($token->{type} == COMMENT_TOKEN) { |
3575 |
my $comment = $self->{document}->create_comment ($token->{data}); |
my $comment = $self->{document}->create_comment ($token->{data}); |
3576 |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
3584 |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
3585 |
} |
} |
3586 |
!!!next-token; |
!!!next-token; |
3587 |
redo B; |
next B; |
3588 |
} elsif ($self->{insertion_mode} & HEAD_IMS) { |
} elsif ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM) { |
3589 |
|
if ($token->{type} == CHARACTER_TOKEN) { |
3590 |
|
!!!cp ('t87.1'); |
3591 |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
3592 |
|
!!!next-token; |
3593 |
|
next B; |
3594 |
|
} elsif ($token->{type} == START_TAG_TOKEN) { |
3595 |
|
if ($self->{open_elements}->[-1]->[1] & FOREIGN_FLOW_CONTENT_EL or |
3596 |
|
not ($self->{open_elements}->[-1]->[1] & FOREIGN_EL) or |
3597 |
|
($token->{tag_name} eq 'svg' and |
3598 |
|
$self->{open_elements}->[-1]->[1] & MML_AXML_EL)) { |
3599 |
|
## NOTE: "using the rules for secondary insertion mode"then"continue" |
3600 |
|
!!!cp ('t87.2'); |
3601 |
|
# |
3602 |
|
} elsif ({ |
3603 |
|
## TODO: |
3604 |
|
}->{$token->{tag_name}}) { |
3605 |
|
!!!cp ('t87.2'); |
3606 |
|
!!!parse-error (type => 'not closed', |
3607 |
|
value => $self->{open_elements}->[-1]->[0] |
3608 |
|
->manakai_local_name, |
3609 |
|
token => $token); |
3610 |
|
|
3611 |
|
pop @{$self->{open_elements}} |
3612 |
|
while $self->{open_elements}->[-1]->[1] & FOREIGN_EL; |
3613 |
|
|
3614 |
|
$self->{insertion_mode} &= ~ $self->{insertion_mode}; |
3615 |
|
## Reprocess. |
3616 |
|
next B; |
3617 |
|
} else { |
3618 |
|
## TODO: case fixup |
3619 |
|
|
3620 |
|
!!!insert-element-f ($self->{open_elements}->[-1]->[0]->namespace_uri, $token); |
3621 |
|
|
3622 |
|
if ($self->{self_closing}) { |
3623 |
|
pop @{$self->{open_elements}}; |
3624 |
|
!!!ack ('t87.3'); |
3625 |
|
} else { |
3626 |
|
!!!cp ('t87.4'); |
3627 |
|
} |
3628 |
|
|
3629 |
|
!!!next-token; |
3630 |
|
next B; |
3631 |
|
} |
3632 |
|
} elsif ($token->{type} == END_TAG_TOKEN) { |
3633 |
|
## NOTE: "using the rules for secondary insertion mode" then "continue" |
3634 |
|
!!!cp ('t87.5'); |
3635 |
|
# |
3636 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
3637 |
|
## NOTE: "using the rules for secondary insertion mode" then "continue" |
3638 |
|
!!!cp ('t87.6'); |
3639 |
|
# |
3640 |
|
## TODO: ... |
3641 |
|
} else { |
3642 |
|
die "$0: $token->{type}: Unknown token type"; |
3643 |
|
} |
3644 |
|
} |
3645 |
|
|
3646 |
|
if ($self->{insertion_mode} & HEAD_IMS) { |
3647 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
3648 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
3649 |
unless ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
unless ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3653 |
!!!cp ('t88.1'); |
!!!cp ('t88.1'); |
3654 |
## Ignore the token. |
## Ignore the token. |
3655 |
!!!next-token; |
!!!next-token; |
3656 |
redo B; |
next B; |
3657 |
} |
} |
3658 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
3659 |
!!!cp ('t88'); |
!!!cp ('t88'); |
3660 |
!!!next-token; |
!!!next-token; |
3661 |
redo B; |
next B; |
3662 |
} |
} |
3663 |
} |
} |
3664 |
|
|
3665 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3666 |
!!!cp ('t89'); |
!!!cp ('t89'); |
3667 |
## As if <head> |
## As if <head> |
3668 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
3669 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
3670 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
3671 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
3699 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
3700 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
3701 |
## reprocess |
## reprocess |
3702 |
redo B; |
next B; |
3703 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
3704 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
3705 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3706 |
!!!cp ('t93'); |
!!!cp ('t93'); |
3707 |
!!!create-element ($self->{head_element}, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
3708 |
$self->{open_elements}->[-1]->[0]->append_child |
$self->{open_elements}->[-1]->[0]->append_child |
3709 |
($self->{head_element}); |
($self->{head_element}); |
3710 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
3712 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3713 |
!!!nack ('t93.1'); |
!!!nack ('t93.1'); |
3714 |
!!!next-token; |
!!!next-token; |
3715 |
redo B; |
next B; |
3716 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3717 |
!!!cp ('t94'); |
!!!cp ('t94'); |
3718 |
# |
# |
3722 |
## Ignore the token |
## Ignore the token |
3723 |
!!!nack ('t95.1'); |
!!!nack ('t95.1'); |
3724 |
!!!next-token; |
!!!next-token; |
3725 |
redo B; |
next B; |
3726 |
} |
} |
3727 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3728 |
!!!cp ('t96'); |
!!!cp ('t96'); |
3729 |
## As if <head> |
## As if <head> |
3730 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
3731 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
3732 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
3733 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
3734 |
|
|
3735 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3736 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
3737 |
} else { |
} else { |
3738 |
!!!cp ('t97'); |
!!!cp ('t97'); |
3739 |
} |
} |
3740 |
|
|
3741 |
if ($token->{tag_name} eq 'base') { |
if ($token->{tag_name} eq 'base') { |
3742 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3766 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3767 |
!!!nack ('t101.1'); |
!!!nack ('t101.1'); |
3768 |
!!!next-token; |
!!!next-token; |
3769 |
redo B; |
next B; |
3770 |
} elsif ($token->{tag_name} eq 'link') { |
} elsif ($token->{tag_name} eq 'link') { |
3771 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3772 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3783 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3784 |
!!!ack ('t103.1'); |
!!!ack ('t103.1'); |
3785 |
!!!next-token; |
!!!next-token; |
3786 |
redo B; |
next B; |
3787 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
3788 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3789 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3848 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3849 |
!!!ack ('t110.1'); |
!!!ack ('t110.1'); |
3850 |
!!!next-token; |
!!!next-token; |
3851 |
redo B; |
next B; |
3852 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
3853 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3854 |
!!!cp ('t111'); |
!!!cp ('t111'); |
3873 |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
3874 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
3875 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3876 |
redo B; |
next B; |
3877 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
3878 |
## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and |
## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and |
3879 |
## insertion mode IN_HEAD_IM) |
## insertion mode IN_HEAD_IM) |
3889 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
3890 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
3891 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3892 |
redo B; |
next B; |
3893 |
} elsif ($token->{tag_name} eq 'noscript') { |
} elsif ($token->{tag_name} eq 'noscript') { |
3894 |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
3895 |
!!!cp ('t116'); |
!!!cp ('t116'); |
3898 |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
3899 |
!!!nack ('t116.1'); |
!!!nack ('t116.1'); |
3900 |
!!!next-token; |
!!!next-token; |
3901 |
redo B; |
next B; |
3902 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3903 |
!!!cp ('t117'); |
!!!cp ('t117'); |
3904 |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
3905 |
## Ignore the token |
## Ignore the token |
3906 |
!!!nack ('t117.1'); |
!!!nack ('t117.1'); |
3907 |
!!!next-token; |
!!!next-token; |
3908 |
redo B; |
next B; |
3909 |
} else { |
} else { |
3910 |
!!!cp ('t118'); |
!!!cp ('t118'); |
3911 |
# |
# |
3932 |
$script_start_tag->(); |
$script_start_tag->(); |
3933 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
3934 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3935 |
redo B; |
next B; |
3936 |
} elsif ($token->{tag_name} eq 'body' or |
} elsif ($token->{tag_name} eq 'body' or |
3937 |
$token->{tag_name} eq 'frameset') { |
$token->{tag_name} eq 'frameset') { |
3938 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3968 |
} |
} |
3969 |
!!!nack ('t127.1'); |
!!!nack ('t127.1'); |
3970 |
!!!next-token; |
!!!next-token; |
3971 |
redo B; |
next B; |
3972 |
} else { |
} else { |
3973 |
!!!cp ('t128'); |
!!!cp ('t128'); |
3974 |
# |
# |
4001 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
4002 |
## reprocess |
## reprocess |
4003 |
!!!ack-later; |
!!!ack-later; |
4004 |
redo B; |
next B; |
4005 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
4006 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
4007 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
4008 |
!!!cp ('t132'); |
!!!cp ('t132'); |
4009 |
## As if <head> |
## As if <head> |
4010 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
4011 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
4012 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4013 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4016 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4017 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
4018 |
!!!next-token; |
!!!next-token; |
4019 |
redo B; |
next B; |
4020 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
4021 |
!!!cp ('t133'); |
!!!cp ('t133'); |
4022 |
## As if </noscript> |
## As if </noscript> |
4027 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4028 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
4029 |
!!!next-token; |
!!!next-token; |
4030 |
redo B; |
next B; |
4031 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
4032 |
!!!cp ('t134'); |
!!!cp ('t134'); |
4033 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4034 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
4035 |
!!!next-token; |
!!!next-token; |
4036 |
redo B; |
next B; |
4037 |
} else { |
} else { |
4038 |
!!!cp ('t135'); |
!!!cp ('t135'); |
4039 |
# |
# |
4044 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4045 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
4046 |
!!!next-token; |
!!!next-token; |
4047 |
redo B; |
next B; |
4048 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
4049 |
!!!cp ('t137'); |
!!!cp ('t137'); |
4050 |
!!!parse-error (type => 'unmatched end tag:noscript', token => $token); |
!!!parse-error (type => 'unmatched end tag:noscript', token => $token); |
4051 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
4052 |
!!!next-token; |
!!!next-token; |
4053 |
redo B; |
next B; |
4054 |
} else { |
} else { |
4055 |
!!!cp ('t138'); |
!!!cp ('t138'); |
4056 |
# |
# |
4061 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
4062 |
!!!cp ('t139'); |
!!!cp ('t139'); |
4063 |
## As if <head> |
## As if <head> |
4064 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
4065 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
4066 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4067 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4073 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4074 |
## Ignore the token |
## Ignore the token |
4075 |
!!!next-token; |
!!!next-token; |
4076 |
redo B; |
next B; |
4077 |
} else { |
} else { |
4078 |
!!!cp ('t141'); |
!!!cp ('t141'); |
4079 |
} |
} |
4085 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
4086 |
!!!cp ('t142'); |
!!!cp ('t142'); |
4087 |
## As if <head> |
## As if <head> |
4088 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
4089 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
4090 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4091 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4106 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4107 |
## Ignore the token |
## Ignore the token |
4108 |
!!!next-token; |
!!!next-token; |
4109 |
redo B; |
next B; |
4110 |
} |
} |
4111 |
} |
} |
4112 |
|
|
4133 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4134 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
4135 |
!!!next-token; |
!!!next-token; |
4136 |
redo B; |
next B; |
4137 |
} else { |
} else { |
4138 |
!!!cp ('t149'); |
!!!cp ('t149'); |
4139 |
} |
} |
4143 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
4144 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
4145 |
## reprocess |
## reprocess |
4146 |
redo B; |
next B; |
4147 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
4148 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
4149 |
!!!cp ('t149.1'); |
!!!cp ('t149.1'); |
4150 |
|
|
4151 |
## NOTE: As if <head> |
## NOTE: As if <head> |
4152 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
4153 |
$self->{open_elements}->[-1]->[0]->append_child |
$self->{open_elements}->[-1]->[0]->append_child |
4154 |
($self->{head_element}); |
($self->{head_element}); |
4155 |
#push @{$self->{open_elements}}, |
#push @{$self->{open_elements}}, |
4197 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
4198 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
4199 |
## NOTE: Reprocess. |
## NOTE: Reprocess. |
4200 |
redo B; |
next B; |
4201 |
} else { |
} else { |
4202 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
4203 |
} |
} |
4212 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
4213 |
|
|
4214 |
!!!next-token; |
!!!next-token; |
4215 |
redo B; |
next B; |
4216 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
4217 |
if ({ |
if ({ |
4218 |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
4231 |
tag_name => $node->[0]->manakai_local_name, |
tag_name => $node->[0]->manakai_local_name, |
4232 |
line => $token->{line}, |
line => $token->{line}, |
4233 |
column => $token->{column}}; |
column => $token->{column}}; |
4234 |
redo B; |
next B; |
4235 |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
4236 |
!!!cp ('t152'); |
!!!cp ('t152'); |
4237 |
## ISSUE: This case can never be reached, maybe. |
## ISSUE: This case can never be reached, maybe. |
4245 |
## Ignore the token |
## Ignore the token |
4246 |
!!!nack ('t153.1'); |
!!!nack ('t153.1'); |
4247 |
!!!next-token; |
!!!next-token; |
4248 |
redo B; |
next B; |
4249 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
4250 |
!!!parse-error (type => 'not closed:caption', token => $token); |
!!!parse-error (type => 'not closed:caption', token => $token); |
4251 |
|
|
4271 |
## Ignore the token |
## Ignore the token |
4272 |
!!!nack ('t157.1'); |
!!!nack ('t157.1'); |
4273 |
!!!next-token; |
!!!next-token; |
4274 |
redo B; |
next B; |
4275 |
} # INSCOPE |
} # INSCOPE |
4276 |
|
|
4277 |
## generate implied end tags |
## generate implied end tags |
4299 |
|
|
4300 |
## reprocess |
## reprocess |
4301 |
!!!ack-later; |
!!!ack-later; |
4302 |
redo B; |
next B; |
4303 |
} else { |
} else { |
4304 |
!!!cp ('t161'); |
!!!cp ('t161'); |
4305 |
# |
# |
4329 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4330 |
## Ignore the token |
## Ignore the token |
4331 |
!!!next-token; |
!!!next-token; |
4332 |
redo B; |
next B; |
4333 |
} |
} |
4334 |
|
|
4335 |
## generate implied end tags |
## generate implied end tags |
4357 |
$self->{insertion_mode} = IN_ROW_IM; |
$self->{insertion_mode} = IN_ROW_IM; |
4358 |
|
|
4359 |
!!!next-token; |
!!!next-token; |
4360 |
redo B; |
next B; |
4361 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
4362 |
!!!cp ('t169'); |
!!!cp ('t169'); |
4363 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4364 |
## Ignore the token |
## Ignore the token |
4365 |
!!!next-token; |
!!!next-token; |
4366 |
redo B; |
next B; |
4367 |
} else { |
} else { |
4368 |
!!!cp ('t170'); |
!!!cp ('t170'); |
4369 |
# |
# |
4390 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
4391 |
## Ignore the token |
## Ignore the token |
4392 |
!!!next-token; |
!!!next-token; |
4393 |
redo B; |
next B; |
4394 |
} # INSCOPE |
} # INSCOPE |
4395 |
|
|
4396 |
## generate implied end tags |
## generate implied end tags |
4417 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
4418 |
|
|
4419 |
!!!next-token; |
!!!next-token; |
4420 |
redo B; |
next B; |
4421 |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
4422 |
!!!cp ('t177'); |
!!!cp ('t177'); |
4423 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4424 |
## Ignore the token |
## Ignore the token |
4425 |
!!!next-token; |
!!!next-token; |
4426 |
redo B; |
next B; |
4427 |
} else { |
} else { |
4428 |
!!!cp ('t178'); |
!!!cp ('t178'); |
4429 |
# |
# |
4448 |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
4449 |
line => $token->{line}, |
line => $token->{line}, |
4450 |
column => $token->{column}}; |
column => $token->{column}}; |
4451 |
redo B; |
next B; |
4452 |
} elsif ($node->[1] & TABLE_CELL_EL) { |
} elsif ($node->[1] & TABLE_CELL_EL) { |
4453 |
!!!cp ('t180'); |
!!!cp ('t180'); |
4454 |
$tn = $node->[0]->manakai_local_name; |
$tn = $node->[0]->manakai_local_name; |
4466 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
4467 |
## Ignore the token |
## Ignore the token |
4468 |
!!!next-token; |
!!!next-token; |
4469 |
redo B; |
next B; |
4470 |
} # INSCOPE |
} # INSCOPE |
4471 |
} elsif ($token->{tag_name} eq 'table' and |
} elsif ($token->{tag_name} eq 'table' and |
4472 |
$self->{insertion_mode} == IN_CAPTION_IM) { |
$self->{insertion_mode} == IN_CAPTION_IM) { |
4491 |
!!!parse-error (type => 'unmatched end tag:caption', token => $token); |
!!!parse-error (type => 'unmatched end tag:caption', token => $token); |
4492 |
## Ignore the token |
## Ignore the token |
4493 |
!!!next-token; |
!!!next-token; |
4494 |
redo B; |
next B; |
4495 |
} |
} |
4496 |
|
|
4497 |
## generate implied end tags |
## generate implied end tags |
4517 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
4518 |
|
|
4519 |
## reprocess |
## reprocess |
4520 |
redo B; |
next B; |
4521 |
} elsif ({ |
} elsif ({ |
4522 |
body => 1, col => 1, colgroup => 1, html => 1, |
body => 1, col => 1, colgroup => 1, html => 1, |
4523 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4526 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4527 |
## Ignore the token |
## Ignore the token |
4528 |
!!!next-token; |
!!!next-token; |
4529 |
redo B; |
next B; |
4530 |
} else { |
} else { |
4531 |
!!!cp ('t191'); |
!!!cp ('t191'); |
4532 |
# |
# |
4540 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4541 |
## Ignore the token |
## Ignore the token |
4542 |
!!!next-token; |
!!!next-token; |
4543 |
redo B; |
next B; |
4544 |
} else { |
} else { |
4545 |
!!!cp ('t193'); |
!!!cp ('t193'); |
4546 |
# |
# |
4571 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
4572 |
!!!cp ('t194'); |
!!!cp ('t194'); |
4573 |
!!!next-token; |
!!!next-token; |
4574 |
redo B; |
next B; |
4575 |
} else { |
} else { |
4576 |
!!!cp ('t195'); |
!!!cp ('t195'); |
4577 |
} |
} |
4626 |
} |
} |
4627 |
|
|
4628 |
!!!next-token; |
!!!next-token; |
4629 |
redo B; |
next B; |
4630 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
4631 |
if ({ |
if ({ |
4632 |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
4665 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
4666 |
!!!nack ('t204'); |
!!!nack ('t204'); |
4667 |
!!!next-token; |
!!!next-token; |
4668 |
redo B; |
next B; |
4669 |
} else { |
} else { |
4670 |
!!!cp ('t205'); |
!!!cp ('t205'); |
4671 |
!!!insert-element ('tr',, $token); |
!!!insert-element ('tr',, $token); |
4689 |
|
|
4690 |
!!!nack ('t207.1'); |
!!!nack ('t207.1'); |
4691 |
!!!next-token; |
!!!next-token; |
4692 |
redo B; |
next B; |
4693 |
} elsif ({ |
} elsif ({ |
4694 |
caption => 1, col => 1, colgroup => 1, |
caption => 1, col => 1, colgroup => 1, |
4695 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
4717 |
## Ignore the token |
## Ignore the token |
4718 |
!!!nack ('t210.1'); |
!!!nack ('t210.1'); |
4719 |
!!!next-token; |
!!!next-token; |
4720 |
redo B; |
next B; |
4721 |
} |
} |
4722 |
|
|
4723 |
## Clear back to table row context |
## Clear back to table row context |
4734 |
!!!cp ('t212'); |
!!!cp ('t212'); |
4735 |
## reprocess |
## reprocess |
4736 |
!!!ack-later; |
!!!ack-later; |
4737 |
redo B; |
next B; |
4738 |
} else { |
} else { |
4739 |
!!!cp ('t213'); |
!!!cp ('t213'); |
4740 |
## reprocess in the "in table body" insertion mode... |
## reprocess in the "in table body" insertion mode... |
4762 |
## Ignore the token |
## Ignore the token |
4763 |
!!!nack ('t216.1'); |
!!!nack ('t216.1'); |
4764 |
!!!next-token; |
!!!next-token; |
4765 |
redo B; |
next B; |
4766 |
} |
} |
4767 |
|
|
4768 |
## Clear back to table body context |
## Clear back to table body context |
4800 |
$self->{insertion_mode} = IN_COLUMN_GROUP_IM; |
$self->{insertion_mode} = IN_COLUMN_GROUP_IM; |
4801 |
## reprocess |
## reprocess |
4802 |
!!!ack-later; |
!!!ack-later; |
4803 |
redo B; |
next B; |
4804 |
} elsif ({ |
} elsif ({ |
4805 |
caption => 1, |
caption => 1, |
4806 |
colgroup => 1, |
colgroup => 1, |
4827 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
4828 |
!!!next-token; |
!!!next-token; |
4829 |
!!!nack ('t220.1'); |
!!!nack ('t220.1'); |
4830 |
redo B; |
next B; |
4831 |
} else { |
} else { |
4832 |
die "$0: in table: <>: $token->{tag_name}"; |
die "$0: in table: <>: $token->{tag_name}"; |
4833 |
} |
} |
4858 |
## Ignore tokens </table><table> |
## Ignore tokens </table><table> |
4859 |
!!!nack ('t223.1'); |
!!!nack ('t223.1'); |
4860 |
!!!next-token; |
!!!next-token; |
4861 |
redo B; |
next B; |
4862 |
} |
} |
4863 |
|
|
4864 |
## TODO: Followings are removed from the latest spec. |
## TODO: Followings are removed from the latest spec. |
4886 |
|
|
4887 |
## reprocess |
## reprocess |
4888 |
!!!ack-later; |
!!!ack-later; |
4889 |
redo B; |
next B; |
4890 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
4891 |
if (not $open_tables->[-1]->[1]) { # tainted |
if (not $open_tables->[-1]->[1]) { # tainted |
4892 |
!!!cp ('t227.8'); |
!!!cp ('t227.8'); |
4893 |
## NOTE: This is a "as if in head" code clone. |
## NOTE: This is a "as if in head" code clone. |
4894 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
4895 |
redo B; |
next B; |
4896 |
} else { |
} else { |
4897 |
!!!cp ('t227.7'); |
!!!cp ('t227.7'); |
4898 |
# |
# |
4902 |
!!!cp ('t227.6'); |
!!!cp ('t227.6'); |
4903 |
## NOTE: This is a "as if in head" code clone. |
## NOTE: This is a "as if in head" code clone. |
4904 |
$script_start_tag->(); |
$script_start_tag->(); |
4905 |
redo B; |
next B; |
4906 |
} else { |
} else { |
4907 |
!!!cp ('t227.5'); |
!!!cp ('t227.5'); |
4908 |
# |
# |
4923 |
|
|
4924 |
!!!next-token; |
!!!next-token; |
4925 |
!!!ack ('t227.2.1'); |
!!!ack ('t227.2.1'); |
4926 |
redo B; |
next B; |
4927 |
} else { |
} else { |
4928 |
!!!cp ('t227.2'); |
!!!cp ('t227.2'); |
4929 |
# |
# |
4967 |
## Ignore the token |
## Ignore the token |
4968 |
!!!nack ('t230.1'); |
!!!nack ('t230.1'); |
4969 |
!!!next-token; |
!!!next-token; |
4970 |
redo B; |
next B; |
4971 |
} else { |
} else { |
4972 |
!!!cp ('t232'); |
!!!cp ('t232'); |
4973 |
} |
} |
4984 |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
4985 |
!!!next-token; |
!!!next-token; |
4986 |
!!!nack ('t231.1'); |
!!!nack ('t231.1'); |
4987 |
redo B; |
next B; |
4988 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
4989 |
if ($self->{insertion_mode} == IN_ROW_IM) { |
if ($self->{insertion_mode} == IN_ROW_IM) { |
4990 |
## As if </tr> |
## As if </tr> |
5008 |
## Ignore the token |
## Ignore the token |
5009 |
!!!nack ('t236.1'); |
!!!nack ('t236.1'); |
5010 |
!!!next-token; |
!!!next-token; |
5011 |
redo B; |
next B; |
5012 |
} |
} |
5013 |
|
|
5014 |
## Clear back to table row context |
## Clear back to table row context |
5044 |
## Ignore the token |
## Ignore the token |
5045 |
!!!nack ('t239.1'); |
!!!nack ('t239.1'); |
5046 |
!!!next-token; |
!!!next-token; |
5047 |
redo B; |
next B; |
5048 |
} |
} |
5049 |
|
|
5050 |
## Clear back to table body context |
## Clear back to table body context |
5090 |
## Ignore the token |
## Ignore the token |
5091 |
!!!nack ('t243.1'); |
!!!nack ('t243.1'); |
5092 |
!!!next-token; |
!!!next-token; |
5093 |
redo B; |
next B; |
5094 |
} |
} |
5095 |
|
|
5096 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
5099 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
5100 |
|
|
5101 |
!!!next-token; |
!!!next-token; |
5102 |
redo B; |
next B; |
5103 |
} elsif ({ |
} elsif ({ |
5104 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
5105 |
}->{$token->{tag_name}} and |
}->{$token->{tag_name}} and |
5124 |
## Ignore the token |
## Ignore the token |
5125 |
!!!nack ('t249.1'); |
!!!nack ('t249.1'); |
5126 |
!!!next-token; |
!!!next-token; |
5127 |
redo B; |
next B; |
5128 |
} |
} |
5129 |
|
|
5130 |
## As if </tr> |
## As if </tr> |
5147 |
## Ignore the token |
## Ignore the token |
5148 |
!!!nack ('t252.1'); |
!!!nack ('t252.1'); |
5149 |
!!!next-token; |
!!!next-token; |
5150 |
redo B; |
next B; |
5151 |
} |
} |
5152 |
|
|
5153 |
## Clear back to table row context |
## Clear back to table row context |
5182 |
## Ignore the token |
## Ignore the token |
5183 |
!!!nack ('t256.1'); |
!!!nack ('t256.1'); |
5184 |
!!!next-token; |
!!!next-token; |
5185 |
redo B; |
next B; |
5186 |
} |
} |
5187 |
|
|
5188 |
## Clear back to table body context |
## Clear back to table body context |
5197 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
5198 |
!!!nack ('t257.1'); |
!!!nack ('t257.1'); |
5199 |
!!!next-token; |
!!!next-token; |
5200 |
redo B; |
next B; |
5201 |
} elsif ({ |
} elsif ({ |
5202 |
body => 1, caption => 1, col => 1, colgroup => 1, |
body => 1, caption => 1, col => 1, colgroup => 1, |
5203 |
html => 1, td => 1, th => 1, |
html => 1, td => 1, th => 1, |
5209 |
## Ignore the token |
## Ignore the token |
5210 |
!!!nack ('t258.1'); |
!!!nack ('t258.1'); |
5211 |
!!!next-token; |
!!!next-token; |
5212 |
redo B; |
next B; |
5213 |
} else { |
} else { |
5214 |
!!!cp ('t259'); |
!!!cp ('t259'); |
5215 |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
5240 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
5241 |
!!!cp ('t260'); |
!!!cp ('t260'); |
5242 |
!!!next-token; |
!!!next-token; |
5243 |
redo B; |
next B; |
5244 |
} |
} |
5245 |
} |
} |
5246 |
|
|
5253 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5254 |
!!!ack ('t262.1'); |
!!!ack ('t262.1'); |
5255 |
!!!next-token; |
!!!next-token; |
5256 |
redo B; |
next B; |
5257 |
} else { |
} else { |
5258 |
!!!cp ('t263'); |
!!!cp ('t263'); |
5259 |
# |
# |
5265 |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
5266 |
## Ignore the token |
## Ignore the token |
5267 |
!!!next-token; |
!!!next-token; |
5268 |
redo B; |
next B; |
5269 |
} else { |
} else { |
5270 |
!!!cp ('t265'); |
!!!cp ('t265'); |
5271 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
5272 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
5273 |
!!!next-token; |
!!!next-token; |
5274 |
redo B; |
next B; |
5275 |
} |
} |
5276 |
} elsif ($token->{tag_name} eq 'col') { |
} elsif ($token->{tag_name} eq 'col') { |
5277 |
!!!cp ('t266'); |
!!!cp ('t266'); |
5278 |
!!!parse-error (type => 'unmatched end tag:col', token => $token); |
!!!parse-error (type => 'unmatched end tag:col', token => $token); |
5279 |
## Ignore the token |
## Ignore the token |
5280 |
!!!next-token; |
!!!next-token; |
5281 |
redo B; |
next B; |
5282 |
} else { |
} else { |
5283 |
!!!cp ('t267'); |
!!!cp ('t267'); |
5284 |
# |
# |
5295 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
5296 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
5297 |
## Reprocess. |
## Reprocess. |
5298 |
redo B; |
next B; |
5299 |
} |
} |
5300 |
} else { |
} else { |
5301 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
5309 |
## Ignore the token |
## Ignore the token |
5310 |
!!!nack ('t269.1'); |
!!!nack ('t269.1'); |
5311 |
!!!next-token; |
!!!next-token; |
5312 |
redo B; |
next B; |
5313 |
} else { |
} else { |
5314 |
!!!cp ('t270'); |
!!!cp ('t270'); |
5315 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
5316 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
5317 |
!!!ack-later; |
!!!ack-later; |
5318 |
## reprocess |
## reprocess |
5319 |
redo B; |
next B; |
5320 |
} |
} |
5321 |
} elsif ($self->{insertion_mode} & SELECT_IMS) { |
} elsif ($self->{insertion_mode} & SELECT_IMS) { |
5322 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
5323 |
!!!cp ('t271'); |
!!!cp ('t271'); |
5324 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
5325 |
!!!next-token; |
!!!next-token; |
5326 |
redo B; |
next B; |
5327 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
5328 |
if ($token->{tag_name} eq 'option') { |
if ($token->{tag_name} eq 'option') { |
5329 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
5337 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5338 |
!!!nack ('t273.1'); |
!!!nack ('t273.1'); |
5339 |
!!!next-token; |
!!!next-token; |
5340 |
redo B; |
next B; |
5341 |
} elsif ($token->{tag_name} eq 'optgroup') { |
} elsif ($token->{tag_name} eq 'optgroup') { |
5342 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
5343 |
!!!cp ('t274'); |
!!!cp ('t274'); |
5358 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5359 |
!!!nack ('t277.1'); |
!!!nack ('t277.1'); |
5360 |
!!!next-token; |
!!!next-token; |
5361 |
redo B; |
next B; |
5362 |
} elsif ($token->{tag_name} eq 'select' or |
} elsif ($token->{tag_name} eq 'select' or |
5363 |
$token->{tag_name} eq 'input' or |
$token->{tag_name} eq 'input' or |
5364 |
($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
5390 |
## Ignore the token |
## Ignore the token |
5391 |
!!!nack ('t280.1'); |
!!!nack ('t280.1'); |
5392 |
!!!next-token; |
!!!next-token; |
5393 |
redo B; |
next B; |
5394 |
} |
} |
5395 |
|
|
5396 |
!!!cp ('t281'); |
!!!cp ('t281'); |
5401 |
if ($token->{tag_name} eq 'select') { |
if ($token->{tag_name} eq 'select') { |
5402 |
!!!nack ('t281.2'); |
!!!nack ('t281.2'); |
5403 |
!!!next-token; |
!!!next-token; |
5404 |
redo B; |
next B; |
5405 |
} else { |
} else { |
5406 |
!!!cp ('t281.1'); |
!!!cp ('t281.1'); |
5407 |
!!!ack-later; |
!!!ack-later; |
5408 |
## Reprocess the token. |
## Reprocess the token. |
5409 |
redo B; |
next B; |
5410 |
} |
} |
5411 |
} else { |
} else { |
5412 |
!!!cp ('t282'); |
!!!cp ('t282'); |
5414 |
## Ignore the token |
## Ignore the token |
5415 |
!!!nack ('t282.1'); |
!!!nack ('t282.1'); |
5416 |
!!!next-token; |
!!!next-token; |
5417 |
redo B; |
next B; |
5418 |
} |
} |
5419 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
5420 |
if ($token->{tag_name} eq 'optgroup') { |
if ($token->{tag_name} eq 'optgroup') { |
5433 |
} |
} |
5434 |
!!!nack ('t285.1'); |
!!!nack ('t285.1'); |
5435 |
!!!next-token; |
!!!next-token; |
5436 |
redo B; |
next B; |
5437 |
} elsif ($token->{tag_name} eq 'option') { |
} elsif ($token->{tag_name} eq 'option') { |
5438 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
5439 |
!!!cp ('t286'); |
!!!cp ('t286'); |
5445 |
} |
} |
5446 |
!!!nack ('t287.1'); |
!!!nack ('t287.1'); |
5447 |
!!!next-token; |
!!!next-token; |
5448 |
redo B; |
next B; |
5449 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
5450 |
## have an element in table scope |
## have an element in table scope |
5451 |
my $i; |
my $i; |
5466 |
## Ignore the token |
## Ignore the token |
5467 |
!!!nack ('t290.1'); |
!!!nack ('t290.1'); |
5468 |
!!!next-token; |
!!!next-token; |
5469 |
redo B; |
next B; |
5470 |
} |
} |
5471 |
|
|
5472 |
!!!cp ('t291'); |
!!!cp ('t291'); |
5476 |
|
|
5477 |
!!!nack ('t291.1'); |
!!!nack ('t291.1'); |
5478 |
!!!next-token; |
!!!next-token; |
5479 |
redo B; |
next B; |
5480 |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
5481 |
{ |
{ |
5482 |
caption => 1, table => 1, tbody => 1, |
caption => 1, table => 1, tbody => 1, |
5503 |
## Ignore the token |
## Ignore the token |
5504 |
!!!nack ('t294.1'); |
!!!nack ('t294.1'); |
5505 |
!!!next-token; |
!!!next-token; |
5506 |
redo B; |
next B; |
5507 |
} |
} |
5508 |
|
|
5509 |
## As if </select> |
## As if </select> |
5528 |
## Ignore the </select> token |
## Ignore the </select> token |
5529 |
!!!nack ('t297.1'); |
!!!nack ('t297.1'); |
5530 |
!!!next-token; ## TODO: ok? |
!!!next-token; ## TODO: ok? |
5531 |
redo B; |
next B; |
5532 |
} |
} |
5533 |
|
|
5534 |
!!!cp ('t298'); |
!!!cp ('t298'); |
5538 |
|
|
5539 |
!!!ack-later; |
!!!ack-later; |
5540 |
## reprocess |
## reprocess |
5541 |
redo B; |
next B; |
5542 |
} else { |
} else { |
5543 |
!!!cp ('t299'); |
!!!cp ('t299'); |
5544 |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
5545 |
## Ignore the token |
## Ignore the token |
5546 |
!!!nack ('t299.3'); |
!!!nack ('t299.3'); |
5547 |
!!!next-token; |
!!!next-token; |
5548 |
redo B; |
next B; |
5549 |
} |
} |
5550 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
5551 |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
5573 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
5574 |
!!!cp ('t300'); |
!!!cp ('t300'); |
5575 |
!!!next-token; |
!!!next-token; |
5576 |
redo B; |
next B; |
5577 |
} |
} |
5578 |
} |
} |
5579 |
|
|
5591 |
|
|
5592 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
5593 |
## reprocess |
## reprocess |
5594 |
redo B; |
next B; |
5595 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
5596 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
5597 |
!!!cp ('t303'); |
!!!cp ('t303'); |
5608 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
5609 |
!!!ack-later; |
!!!ack-later; |
5610 |
## reprocess |
## reprocess |
5611 |
redo B; |
next B; |
5612 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
5613 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
5614 |
!!!cp ('t305'); |
!!!cp ('t305'); |
5627 |
!!!parse-error (type => 'unmatched end tag:html', token => $token); |
!!!parse-error (type => 'unmatched end tag:html', token => $token); |
5628 |
## Ignore the token |
## Ignore the token |
5629 |
!!!next-token; |
!!!next-token; |
5630 |
redo B; |
next B; |
5631 |
} else { |
} else { |
5632 |
!!!cp ('t308'); |
!!!cp ('t308'); |
5633 |
$self->{insertion_mode} = AFTER_HTML_BODY_IM; |
$self->{insertion_mode} = AFTER_HTML_BODY_IM; |
5634 |
!!!next-token; |
!!!next-token; |
5635 |
redo B; |
next B; |
5636 |
} |
} |
5637 |
} else { |
} else { |
5638 |
!!!cp ('t309'); |
!!!cp ('t309'); |
5640 |
|
|
5641 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
5642 |
## reprocess |
## reprocess |
5643 |
redo B; |
next B; |
5644 |
} |
} |
5645 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
5646 |
!!!cp ('t309.2'); |
!!!cp ('t309.2'); |
5657 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
5658 |
!!!cp ('t310'); |
!!!cp ('t310'); |
5659 |
!!!next-token; |
!!!next-token; |
5660 |
redo B; |
next B; |
5661 |
} |
} |
5662 |
} |
} |
5663 |
|
|
5685 |
!!!cp ('t315'); |
!!!cp ('t315'); |
5686 |
!!!next-token; |
!!!next-token; |
5687 |
} |
} |
5688 |
redo B; |
next B; |
5689 |
} |
} |
5690 |
|
|
5691 |
die qq[$0: Character "$token->{data}"]; |
die qq[$0: Character "$token->{data}"]; |
5706 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5707 |
!!!nack ('t318.1'); |
!!!nack ('t318.1'); |
5708 |
!!!next-token; |
!!!next-token; |
5709 |
redo B; |
next B; |
5710 |
} elsif ($token->{tag_name} eq 'frame' and |
} elsif ($token->{tag_name} eq 'frame' and |
5711 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
5712 |
!!!cp ('t319'); |
!!!cp ('t319'); |
5714 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5715 |
!!!ack ('t319.1'); |
!!!ack ('t319.1'); |
5716 |
!!!next-token; |
!!!next-token; |
5717 |
redo B; |
next B; |
5718 |
} elsif ($token->{tag_name} eq 'noframes') { |
} elsif ($token->{tag_name} eq 'noframes') { |
5719 |
!!!cp ('t320'); |
!!!cp ('t320'); |
5720 |
## NOTE: As if in body. |
## NOTE: As if in body. |
5721 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
5722 |
redo B; |
next B; |
5723 |
} else { |
} else { |
5724 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
5725 |
!!!cp ('t321'); |
!!!cp ('t321'); |
5731 |
## Ignore the token |
## Ignore the token |
5732 |
!!!nack ('t322.1'); |
!!!nack ('t322.1'); |
5733 |
!!!next-token; |
!!!next-token; |
5734 |
redo B; |
next B; |
5735 |
} |
} |
5736 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
5737 |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
5765 |
} else { |
} else { |
5766 |
!!!cp ('t328'); |
!!!cp ('t328'); |
5767 |
} |
} |
5768 |
redo B; |
next B; |
5769 |
} elsif ($token->{tag_name} eq 'html' and |
} elsif ($token->{tag_name} eq 'html' and |
5770 |
$self->{insertion_mode} == AFTER_FRAMESET_IM) { |
$self->{insertion_mode} == AFTER_FRAMESET_IM) { |
5771 |
!!!cp ('t329'); |
!!!cp ('t329'); |
5772 |
$self->{insertion_mode} = AFTER_HTML_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_HTML_FRAMESET_IM; |
5773 |
!!!next-token; |
!!!next-token; |
5774 |
redo B; |
next B; |
5775 |
} else { |
} else { |
5776 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
5777 |
!!!cp ('t330'); |
!!!cp ('t330'); |
5782 |
} |
} |
5783 |
## Ignore the token |
## Ignore the token |
5784 |
!!!next-token; |
!!!next-token; |
5785 |
redo B; |
next B; |
5786 |
} |
} |
5787 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
5788 |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
5810 |
!!!cp ('t332'); |
!!!cp ('t332'); |
5811 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
5812 |
$script_start_tag->(); |
$script_start_tag->(); |
5813 |
redo B; |
next B; |
5814 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
5815 |
!!!cp ('t333'); |
!!!cp ('t333'); |
5816 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
5817 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
5818 |
redo B; |
next B; |
5819 |
} elsif ({ |
} elsif ({ |
5820 |
base => 1, link => 1, |
base => 1, link => 1, |
5821 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5825 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
5826 |
!!!ack ('t334.1'); |
!!!ack ('t334.1'); |
5827 |
!!!next-token; |
!!!next-token; |
5828 |
redo B; |
next B; |
5829 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
5830 |
## 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 |
5831 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
5876 |
|
|
5877 |
!!!ack ('t338.1'); |
!!!ack ('t338.1'); |
5878 |
!!!next-token; |
!!!next-token; |
5879 |
redo B; |
next B; |
5880 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
5881 |
!!!cp ('t341'); |
!!!cp ('t341'); |
5882 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
5883 |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
5884 |
redo B; |
next B; |
5885 |
} elsif ($token->{tag_name} eq 'body') { |
} elsif ($token->{tag_name} eq 'body') { |
5886 |
!!!parse-error (type => 'in body:body', token => $token); |
!!!parse-error (type => 'in body:body', token => $token); |
5887 |
|
|
5902 |
} |
} |
5903 |
!!!nack ('t343.1'); |
!!!nack ('t343.1'); |
5904 |
!!!next-token; |
!!!next-token; |
5905 |
redo B; |
next B; |
5906 |
} elsif ({ |
} elsif ({ |
5907 |
address => 1, blockquote => 1, center => 1, dir => 1, |
address => 1, blockquote => 1, center => 1, dir => 1, |
5908 |
div => 1, dl => 1, fieldset => 1, |
div => 1, dl => 1, fieldset => 1, |
5919 |
## Ignore the token |
## Ignore the token |
5920 |
!!!nack ('t350.1'); |
!!!nack ('t350.1'); |
5921 |
!!!next-token; |
!!!next-token; |
5922 |
redo B; |
next B; |
5923 |
} |
} |
5924 |
|
|
5925 |
## has a p element in scope |
## has a p element in scope |
5929 |
!!!back-token; # <form> |
!!!back-token; # <form> |
5930 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
5931 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
5932 |
redo B; |
next B; |
5933 |
} elsif ($_->[1] & SCOPING_EL) { |
} elsif ($_->[1] & SCOPING_EL) { |
5934 |
!!!cp ('t345'); |
!!!cp ('t345'); |
5935 |
last INSCOPE; |
last INSCOPE; |
5975 |
!!!nack ('t347.1'); |
!!!nack ('t347.1'); |
5976 |
!!!next-token; |
!!!next-token; |
5977 |
} |
} |
5978 |
redo B; |
next B; |
5979 |
} elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) { |
} elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) { |
5980 |
## has a p element in scope |
## has a p element in scope |
5981 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5984 |
!!!back-token; # <x> |
!!!back-token; # <x> |
5985 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
5986 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
5987 |
redo B; |
next B; |
5988 |
} elsif ($_->[1] & SCOPING_EL) { |
} elsif ($_->[1] & SCOPING_EL) { |
5989 |
!!!cp ('t354'); |
!!!cp ('t354'); |
5990 |
last INSCOPE; |
last INSCOPE; |
6036 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
6037 |
!!!nack ('t359.1'); |
!!!nack ('t359.1'); |
6038 |
!!!next-token; |
!!!next-token; |
6039 |
redo B; |
next B; |
6040 |
} elsif ($token->{tag_name} eq 'plaintext') { |
} elsif ($token->{tag_name} eq 'plaintext') { |
6041 |
## has a p element in scope |
## has a p element in scope |
6042 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
6045 |
!!!back-token; # <plaintext> |
!!!back-token; # <plaintext> |
6046 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
6047 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
6048 |
redo B; |
next B; |
6049 |
} elsif ($_->[1] & SCOPING_EL) { |
} elsif ($_->[1] & SCOPING_EL) { |
6050 |
!!!cp ('t368'); |
!!!cp ('t368'); |
6051 |
last INSCOPE; |
last INSCOPE; |
6058 |
|
|
6059 |
!!!nack ('t368.1'); |
!!!nack ('t368.1'); |
6060 |
!!!next-token; |
!!!next-token; |
6061 |
redo B; |
next B; |
6062 |
} elsif ($token->{tag_name} eq 'a') { |
} elsif ($token->{tag_name} eq 'a') { |
6063 |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
6064 |
my $node = $active_formatting_elements->[$i]; |
my $node = $active_formatting_elements->[$i]; |
6099 |
|
|
6100 |
!!!nack ('t374.1'); |
!!!nack ('t374.1'); |
6101 |
!!!next-token; |
!!!next-token; |
6102 |
redo B; |
next B; |
6103 |
} elsif ($token->{tag_name} eq 'nobr') { |
} elsif ($token->{tag_name} eq 'nobr') { |
6104 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
6105 |
|
|
6112 |
!!!back-token; # <nobr> |
!!!back-token; # <nobr> |
6113 |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
6114 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
6115 |
redo B; |
next B; |
6116 |
} elsif ($node->[1] & SCOPING_EL) { |
} elsif ($node->[1] & SCOPING_EL) { |
6117 |
!!!cp ('t377'); |
!!!cp ('t377'); |
6118 |
last INSCOPE; |
last INSCOPE; |
6124 |
|
|
6125 |
!!!nack ('t377.1'); |
!!!nack ('t377.1'); |
6126 |
!!!next-token; |
!!!next-token; |
6127 |
redo B; |
next B; |
6128 |
} elsif ($token->{tag_name} eq 'button') { |
} elsif ($token->{tag_name} eq 'button') { |
6129 |
## has a button element in scope |
## has a button element in scope |
6130 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6135 |
!!!back-token; # <button> |
!!!back-token; # <button> |
6136 |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
6137 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
6138 |
redo B; |
next B; |
6139 |
} elsif ($node->[1] & SCOPING_EL) { |
} elsif ($node->[1] & SCOPING_EL) { |
6140 |
!!!cp ('t379'); |
!!!cp ('t379'); |
6141 |
last INSCOPE; |
last INSCOPE; |
6152 |
|
|
6153 |
!!!nack ('t379.1'); |
!!!nack ('t379.1'); |
6154 |
!!!next-token; |
!!!next-token; |
6155 |
redo B; |
next B; |
6156 |
} elsif ({ |
} elsif ({ |
6157 |
xmp => 1, |
xmp => 1, |
6158 |
iframe => 1, |
iframe => 1, |
6168 |
} |
} |
6169 |
## NOTE: There is an "as if in body" code clone. |
## NOTE: There is an "as if in body" code clone. |
6170 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
6171 |
redo B; |
next B; |
6172 |
} elsif ($token->{tag_name} eq 'isindex') { |
} elsif ($token->{tag_name} eq 'isindex') { |
6173 |
!!!parse-error (type => 'isindex', token => $token); |
!!!parse-error (type => 'isindex', token => $token); |
6174 |
|
|
6177 |
## Ignore the token |
## Ignore the token |
6178 |
!!!nack ('t389'); ## NOTE: Not acknowledged. |
!!!nack ('t389'); ## NOTE: Not acknowledged. |
6179 |
!!!next-token; |
!!!next-token; |
6180 |
redo B; |
next B; |
6181 |
} else { |
} else { |
6182 |
my $at = $token->{attributes}; |
my $at = $token->{attributes}; |
6183 |
my $form_attrs; |
my $form_attrs; |
6225 |
!!!nack ('t391.1'); ## NOTE: Not acknowledged. |
!!!nack ('t391.1'); ## NOTE: Not acknowledged. |
6226 |
!!!back-token (@tokens); |
!!!back-token (@tokens); |
6227 |
!!!next-token; |
!!!next-token; |
6228 |
redo B; |
next B; |
6229 |
} |
} |
6230 |
} elsif ($token->{tag_name} eq 'textarea') { |
} elsif ($token->{tag_name} eq 'textarea') { |
6231 |
my $tag_name = $token->{tag_name}; |
my $tag_name = $token->{tag_name}; |
6232 |
my $el; |
my $el; |
6233 |
!!!create-element ($el, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($el, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
6234 |
|
|
6235 |
## TODO: $self->{form_element} if defined |
## TODO: $self->{form_element} if defined |
6236 |
$self->{content_model} = RCDATA_CONTENT_MODEL; |
$self->{content_model} = RCDATA_CONTENT_MODEL; |
6273 |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}, token => $token); |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}, token => $token); |
6274 |
} |
} |
6275 |
!!!next-token; |
!!!next-token; |
6276 |
redo B; |
next B; |
6277 |
|
} elsif ($token->{tag_name} eq 'math' or |
6278 |
|
$token->{tag_name} eq 'svg') { |
6279 |
|
$reconstruct_active_formatting_elements->($insert_to_current); |
6280 |
|
|
6281 |
|
!!!insert-element-f ($token->{tag_name} eq 'math' ? $MML_NS : $SVG_NS, $token); |
6282 |
|
|
6283 |
|
if ($self->{self_closing}) { |
6284 |
|
pop @{$self->{open_elements}}; |
6285 |
|
!!!ack ('t398.1'); |
6286 |
|
} else { |
6287 |
|
!!!cp ('t398.2'); |
6288 |
|
$self->{insertion_mode} |= IN_FOREIGN_CONTENT_IM; |
6289 |
|
## NOTE: |<body><math><mi><svg>| -> "in foreign content" insertion |
6290 |
|
## mode, "in body" (not "in foreign content") secondary insertion |
6291 |
|
## mode, maybe. |
6292 |
|
} |
6293 |
|
|
6294 |
|
!!!next-token; |
6295 |
|
next B; |
6296 |
} elsif ({ |
} elsif ({ |
6297 |
caption => 1, col => 1, colgroup => 1, frame => 1, |
caption => 1, col => 1, colgroup => 1, frame => 1, |
6298 |
frameset => 1, head => 1, option => 1, optgroup => 1, |
frameset => 1, head => 1, option => 1, optgroup => 1, |
6304 |
## Ignore the token |
## Ignore the token |
6305 |
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
6306 |
!!!next-token; |
!!!next-token; |
6307 |
redo B; |
next B; |
6308 |
|
|
6309 |
## ISSUE: An issue on HTML5 new elements in the spec. |
## ISSUE: An issue on HTML5 new elements in the spec. |
6310 |
} else { |
} else { |
6366 |
} |
} |
6367 |
|
|
6368 |
!!!next-token; |
!!!next-token; |
6369 |
redo B; |
next B; |
6370 |
} |
} |
6371 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
6372 |
if ($token->{tag_name} eq 'body') { |
if ($token->{tag_name} eq 'body') { |
6388 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
6389 |
## NOTE: Ignore the token. |
## NOTE: Ignore the token. |
6390 |
!!!next-token; |
!!!next-token; |
6391 |
redo B; |
next B; |
6392 |
} # INSCOPE |
} # INSCOPE |
6393 |
|
|
6394 |
for (@{$self->{open_elements}}) { |
for (@{$self->{open_elements}}) { |
6405 |
|
|
6406 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
6407 |
!!!next-token; |
!!!next-token; |
6408 |
redo B; |
next B; |
6409 |
} elsif ($token->{tag_name} eq 'html') { |
} elsif ($token->{tag_name} eq 'html') { |
6410 |
## TODO: Update this code. It seems that the code below is not |
## TODO: Update this code. It seems that the code below is not |
6411 |
## up-to-date, though it has same effect as speced. |
## up-to-date, though it has same effect as speced. |
6423 |
} |
} |
6424 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
6425 |
## reprocess |
## reprocess |
6426 |
redo B; |
next B; |
6427 |
} else { |
} else { |
6428 |
!!!cp ('t408'); |
!!!cp ('t408'); |
6429 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
6430 |
## Ignore the token |
## Ignore the token |
6431 |
!!!next-token; |
!!!next-token; |
6432 |
redo B; |
next B; |
6433 |
} |
} |
6434 |
} elsif ({ |
} elsif ({ |
6435 |
address => 1, blockquote => 1, center => 1, dir => 1, |
address => 1, blockquote => 1, center => 1, dir => 1, |
6489 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
6490 |
} |
} |
6491 |
!!!next-token; |
!!!next-token; |
6492 |
redo B; |
next B; |
6493 |
} elsif ($token->{tag_name} eq 'form') { |
} elsif ($token->{tag_name} eq 'form') { |
6494 |
undef $self->{form_element}; |
undef $self->{form_element}; |
6495 |
|
|
6534 |
} |
} |
6535 |
|
|
6536 |
!!!next-token; |
!!!next-token; |
6537 |
redo B; |
next B; |
6538 |
} elsif ({ |
} elsif ({ |
6539 |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
6540 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6576 |
} |
} |
6577 |
|
|
6578 |
!!!next-token; |
!!!next-token; |
6579 |
redo B; |
next B; |
6580 |
} elsif ($token->{tag_name} eq 'p') { |
} elsif ($token->{tag_name} eq 'p') { |
6581 |
## has an element in scope |
## has an element in scope |
6582 |
my $i; |
my $i; |
6612 |
!!!cp ('t415.1'); |
!!!cp ('t415.1'); |
6613 |
## As if <p>, then reprocess the current token |
## As if <p>, then reprocess the current token |
6614 |
my $el; |
my $el; |
6615 |
!!!create-element ($el, 'p',, $token); |
!!!create-element ($el, $HTML_NS, 'p',, $token); |
6616 |
$insert->($el); |
$insert->($el); |
6617 |
## NOTE: Not inserted into |$self->{open_elements}|. |
## NOTE: Not inserted into |$self->{open_elements}|. |
6618 |
} |
} |
6619 |
|
|
6620 |
!!!next-token; |
!!!next-token; |
6621 |
redo B; |
next B; |
6622 |
} elsif ({ |
} elsif ({ |
6623 |
a => 1, |
a => 1, |
6624 |
b => 1, big => 1, em => 1, font => 1, i => 1, |
b => 1, big => 1, em => 1, font => 1, i => 1, |
6627 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6628 |
!!!cp ('t427'); |
!!!cp ('t427'); |
6629 |
$formatting_end_tag->($token); |
$formatting_end_tag->($token); |
6630 |
redo B; |
next B; |
6631 |
} elsif ($token->{tag_name} eq 'br') { |
} elsif ($token->{tag_name} eq 'br') { |
6632 |
!!!cp ('t428'); |
!!!cp ('t428'); |
6633 |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
6636 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
6637 |
|
|
6638 |
my $el; |
my $el; |
6639 |
!!!create-element ($el, 'br',, $token); |
!!!create-element ($el, $HTML_NS, 'br',, $token); |
6640 |
$insert->($el); |
$insert->($el); |
6641 |
|
|
6642 |
## Ignore the token. |
## Ignore the token. |
6643 |
!!!next-token; |
!!!next-token; |
6644 |
redo B; |
next B; |
6645 |
} elsif ({ |
} elsif ({ |
6646 |
caption => 1, col => 1, colgroup => 1, frame => 1, |
caption => 1, col => 1, colgroup => 1, frame => 1, |
6647 |
frameset => 1, head => 1, option => 1, optgroup => 1, |
frameset => 1, head => 1, option => 1, optgroup => 1, |
6658 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
6659 |
## Ignore the token |
## Ignore the token |
6660 |
!!!next-token; |
!!!next-token; |
6661 |
redo B; |
next B; |
6662 |
|
|
6663 |
## ISSUE: Issue on HTML5 new elements in spec |
## ISSUE: Issue on HTML5 new elements in spec |
6664 |
|
|
6719 |
## Step 5; |
## Step 5; |
6720 |
redo S2; |
redo S2; |
6721 |
} # S2 |
} # S2 |
6722 |
redo B; |
next B; |
6723 |
} |
} |
6724 |
} |
} |
6725 |
redo B; |
next B; |
6726 |
|
} continue { # B |
6727 |
|
if ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM) { |
6728 |
|
## NOTE: The code below is executed in cases where it does not have |
6729 |
|
## to be, but it it is harmless even in those cases. |
6730 |
|
## has an element in scope |
6731 |
|
INSCOPE: { |
6732 |
|
for (reverse 0..$#{$self->{open_elements}}) { |
6733 |
|
my $node = $self->{open_elements}->[$_]; |
6734 |
|
if ($node->[1] & FOREIGN_EL) { |
6735 |
|
last INSCOPE; |
6736 |
|
} elsif ($node->[1] & SCOPING_EL) { |
6737 |
|
last; |
6738 |
|
} |
6739 |
|
} |
6740 |
|
|
6741 |
|
## NOTE: No foreign element in scope. |
6742 |
|
$self->{insertion_mode} &= ~ IN_FOREIGN_CONTENT_IM; |
6743 |
|
} # INSCOPE |
6744 |
|
} |
6745 |
} # B |
} # B |
6746 |
|
|
6747 |
## Stop parsing # MUST |
## Stop parsing # MUST |