| 74 |
textarea => 1, tfoot => 1, thead => 1, title => 1, tr => 1, ul => 1, wbr => 1, |
textarea => 1, tfoot => 1, thead => 1, title => 1, tr => 1, ul => 1, wbr => 1, |
| 75 |
}; |
}; |
| 76 |
my $scoping_category = { |
my $scoping_category = { |
| 77 |
button => 1, caption => 1, html => 1, marquee => 1, object => 1, |
applet => 1, button => 1, caption => 1, html => 1, marquee => 1, object => 1, |
| 78 |
table => 1, td => 1, th => 1, |
table => 1, td => 1, th => 1, |
| 79 |
}; |
}; |
| 80 |
my $formatting_category = { |
my $formatting_category = { |
| 3019 |
my $formatting_end_tag = sub { |
my $formatting_end_tag = sub { |
| 3020 |
my $tag_name = shift; |
my $tag_name = shift; |
| 3021 |
|
|
| 3022 |
## NOTE: The adoptioon agency algorithm (AAA). |
## NOTE: The adoption agency algorithm (AAA). |
| 3023 |
|
|
| 3024 |
FET: { |
FET: { |
| 3025 |
## Step 1 |
## Step 1 |
| 3061 |
return; |
return; |
| 3062 |
} |
} |
| 3063 |
} elsif ({ |
} elsif ({ |
| 3064 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 3065 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 3066 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
| 3067 |
!!!cp ('t56'); |
!!!cp ('t56'); |
| 3088 |
if (not $formatting_category->{$node->[1]} and |
if (not $formatting_category->{$node->[1]} and |
| 3089 |
#not $phrasing_category->{$node->[1]} and |
#not $phrasing_category->{$node->[1]} and |
| 3090 |
($special_category->{$node->[1]} or |
($special_category->{$node->[1]} or |
| 3091 |
$scoping_category->{$node->[1]})) { |
$scoping_category->{$node->[1]})) { ## Scoping is redundant, maybe |
| 3092 |
!!!cp ('t59'); |
!!!cp ('t59'); |
| 3093 |
$furthest_block = $node; |
$furthest_block = $node; |
| 3094 |
$furthest_block_i_in_open = $_; |
$furthest_block_i_in_open = $_; |
| 3293 |
## Stay in the phase |
## Stay in the phase |
| 3294 |
!!!next-token; |
!!!next-token; |
| 3295 |
redo B; |
redo B; |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
|
|
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
|
|
!!!cp ('t74'); |
|
|
# |
|
|
} else { |
|
|
## Generate implied end tags |
|
|
while ({ |
|
|
dd => 1, dt => 1, li => 1, p => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
!!!cp ('t75'); |
|
|
pop @{$self->{open_elements}}; |
|
|
} |
|
|
|
|
|
if (@{$self->{open_elements}} > 2 or |
|
|
(@{$self->{open_elements}} == 2 and $self->{open_elements}->[1]->[1] ne 'body')) { |
|
|
!!!cp ('t76'); |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
} elsif (defined $self->{inner_html_node} and |
|
|
@{$self->{open_elements}} > 1 and |
|
|
$self->{open_elements}->[1]->[1] ne 'body') { |
|
|
## ISSUE: This case is never reached. |
|
|
!!!cp ('t77'); |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
} else { |
|
|
!!!cp ('t78'); |
|
|
} |
|
|
|
|
|
## ISSUE: There is an issue in the spec. |
|
|
} |
|
|
|
|
|
## Stop parsing |
|
|
last B; |
|
| 3296 |
} elsif ($token->{type} == START_TAG_TOKEN and |
} elsif ($token->{type} == START_TAG_TOKEN and |
| 3297 |
$token->{tag_name} eq 'html') { |
$token->{tag_name} eq 'html') { |
| 3298 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
| 3811 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 3812 |
## reprocess |
## reprocess |
| 3813 |
redo B; |
redo B; |
| 3814 |
} else { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 3815 |
die "$0: $token->{type}: Unknown token type"; |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3816 |
} |
!!!cp ('t149.1'); |
| 3817 |
|
|
| 3818 |
|
## NOTE: As if <head> |
| 3819 |
|
!!!create-element ($self->{head_element}, 'head'); |
| 3820 |
|
$self->{open_elements}->[-1]->[0]->append_child |
| 3821 |
|
($self->{head_element}); |
| 3822 |
|
#push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
| 3823 |
|
#$self->{insertion_mode} = IN_HEAD_IM; |
| 3824 |
|
## NOTE: Reprocess. |
| 3825 |
|
|
| 3826 |
|
## NOTE: As if </head> |
| 3827 |
|
#pop @{$self->{open_elements}}; |
| 3828 |
|
#$self->{insertion_mode} = IN_AFTER_HEAD_IM; |
| 3829 |
|
## NOTE: Reprocess. |
| 3830 |
|
|
| 3831 |
|
# |
| 3832 |
|
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
| 3833 |
|
!!!cp ('t149.2'); |
| 3834 |
|
|
| 3835 |
|
## NOTE: As if </head> |
| 3836 |
|
pop @{$self->{open_elements}}; |
| 3837 |
|
#$self->{insertion_mode} = IN_AFTER_HEAD_IM; |
| 3838 |
|
## NOTE: Reprocess. |
| 3839 |
|
|
| 3840 |
|
# |
| 3841 |
|
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 3842 |
|
!!!cp ('t149.3'); |
| 3843 |
|
|
| 3844 |
|
!!!parse-error (type => 'in noscript:#eof'); |
| 3845 |
|
|
| 3846 |
|
## As if </noscript> |
| 3847 |
|
pop @{$self->{open_elements}}; |
| 3848 |
|
#$self->{insertion_mode} = IN_HEAD_IM; |
| 3849 |
|
## NOTE: Reprocess. |
| 3850 |
|
|
| 3851 |
|
## NOTE: As if </head> |
| 3852 |
|
pop @{$self->{open_elements}}; |
| 3853 |
|
#$self->{insertion_mode} = IN_AFTER_HEAD_IM; |
| 3854 |
|
## NOTE: Reprocess. |
| 3855 |
|
|
| 3856 |
|
# |
| 3857 |
|
} else { |
| 3858 |
|
!!!cp ('t149.4'); |
| 3859 |
|
# |
| 3860 |
|
} |
| 3861 |
|
|
| 3862 |
|
## NOTE: As if <body> |
| 3863 |
|
!!!insert-element ('body'); |
| 3864 |
|
$self->{insertion_mode} = IN_BODY_IM; |
| 3865 |
|
## NOTE: Reprocess. |
| 3866 |
|
redo B; |
| 3867 |
|
} else { |
| 3868 |
|
die "$0: $token->{type}: Unknown token type"; |
| 3869 |
|
} |
| 3870 |
|
|
| 3871 |
## ISSUE: An issue in the spec. |
## ISSUE: An issue in the spec. |
| 3872 |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
| 3886 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 3887 |
if ($self->{insertion_mode} == IN_CELL_IM) { |
if ($self->{insertion_mode} == IN_CELL_IM) { |
| 3888 |
## have an element in table scope |
## have an element in table scope |
| 3889 |
my $tn; |
for (reverse 0..$#{$self->{open_elements}}) { |
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
|
| 3890 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 3891 |
if ($node->[1] eq 'td' or $node->[1] eq 'th') { |
if ($node->[1] eq 'td' or $node->[1] eq 'th') { |
| 3892 |
!!!cp ('t151'); |
!!!cp ('t151'); |
| 3893 |
$tn = $node->[1]; |
|
| 3894 |
last INSCOPE; |
## Close the cell |
| 3895 |
|
!!!back-token; # <?> |
| 3896 |
|
$token = {type => END_TAG_TOKEN, tag_name => $node->[1]}; |
| 3897 |
|
redo B; |
| 3898 |
} elsif ({ |
} elsif ({ |
| 3899 |
table => 1, html => 1, |
table => 1, html => 1, |
| 3900 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
| 3901 |
!!!cp ('t152'); |
!!!cp ('t152'); |
| 3902 |
last INSCOPE; |
## ISSUE: This case can never be reached, maybe. |
| 3903 |
|
last; |
| 3904 |
} |
} |
| 3905 |
} # INSCOPE |
} |
| 3906 |
unless (defined $tn) { |
|
| 3907 |
!!!cp ('t153'); |
!!!cp ('t153'); |
| 3908 |
## TODO: This error type is wrong. |
!!!parse-error (type => 'start tag not allowed', |
| 3909 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
value => $token->{tag_name}); |
| 3910 |
## Ignore the token |
## Ignore the token |
| 3911 |
!!!next-token; |
!!!next-token; |
|
redo B; |
|
|
} |
|
|
|
|
|
!!!cp ('t154'); |
|
|
## Close the cell |
|
|
!!!back-token; # <?> |
|
|
$token = {type => END_TAG_TOKEN, tag_name => $tn}; |
|
| 3912 |
redo B; |
redo B; |
| 3913 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
| 3914 |
!!!parse-error (type => 'not closed:caption'); |
!!!parse-error (type => 'not closed:caption'); |
| 3915 |
|
|
| 3916 |
## As if </caption> |
## NOTE: As if </caption>. |
| 3917 |
## have a table element in table scope |
## have a table element in table scope |
| 3918 |
my $i; |
my $i; |
| 3919 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: { |
| 3920 |
my $node = $self->{open_elements}->[$_]; |
for (reverse 0..$#{$self->{open_elements}}) { |
| 3921 |
if ($node->[1] eq 'caption') { |
my $node = $self->{open_elements}->[$_]; |
| 3922 |
!!!cp ('t155'); |
if ($node->[1] eq 'caption') { |
| 3923 |
$i = $_; |
!!!cp ('t155'); |
| 3924 |
last INSCOPE; |
$i = $_; |
| 3925 |
} elsif ({ |
last INSCOPE; |
| 3926 |
table => 1, html => 1, |
} elsif ({ |
| 3927 |
}->{$node->[1]}) { |
table => 1, html => 1, |
| 3928 |
!!!cp ('t156'); |
}->{$node->[1]}) { |
| 3929 |
last INSCOPE; |
!!!cp ('t156'); |
| 3930 |
|
last; |
| 3931 |
|
} |
| 3932 |
} |
} |
| 3933 |
|
|
| 3934 |
|
!!!cp ('t157'); |
| 3935 |
|
!!!parse-error (type => 'start tag not allowed', |
| 3936 |
|
value => $token->{tag_name}); |
| 3937 |
|
## Ignore the token |
| 3938 |
|
!!!next-token; |
| 3939 |
|
redo B; |
| 3940 |
} # INSCOPE |
} # INSCOPE |
|
unless (defined $i) { |
|
|
!!!cp ('t157'); |
|
|
## TODO: this type is wrong. |
|
|
!!!parse-error (type => 'unmatched end tag:caption'); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
| 3941 |
|
|
| 3942 |
## generate implied end tags |
## generate implied end tags |
| 3943 |
while ({ |
while ({ |
| 4033 |
if ($self->{insertion_mode} == IN_CAPTION_IM) { |
if ($self->{insertion_mode} == IN_CAPTION_IM) { |
| 4034 |
## have a table element in table scope |
## have a table element in table scope |
| 4035 |
my $i; |
my $i; |
| 4036 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: { |
| 4037 |
my $node = $self->{open_elements}->[$_]; |
for (reverse 0..$#{$self->{open_elements}}) { |
| 4038 |
if ($node->[1] eq $token->{tag_name}) { |
my $node = $self->{open_elements}->[$_]; |
| 4039 |
!!!cp ('t171'); |
if ($node->[1] eq $token->{tag_name}) { |
| 4040 |
$i = $_; |
!!!cp ('t171'); |
| 4041 |
last INSCOPE; |
$i = $_; |
| 4042 |
} elsif ({ |
last INSCOPE; |
| 4043 |
table => 1, html => 1, |
} elsif ({ |
| 4044 |
}->{$node->[1]}) { |
table => 1, html => 1, |
| 4045 |
!!!cp ('t172'); |
}->{$node->[1]}) { |
| 4046 |
last INSCOPE; |
!!!cp ('t172'); |
| 4047 |
|
last; |
| 4048 |
|
} |
| 4049 |
} |
} |
| 4050 |
|
|
| 4051 |
|
!!!cp ('t173'); |
| 4052 |
|
!!!parse-error (type => 'unmatched end tag', |
| 4053 |
|
value => $token->{tag_name}); |
| 4054 |
|
## Ignore the token |
| 4055 |
|
!!!next-token; |
| 4056 |
|
redo B; |
| 4057 |
} # INSCOPE |
} # INSCOPE |
|
unless (defined $i) { |
|
|
!!!cp ('t173'); |
|
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
| 4058 |
|
|
| 4059 |
## generate implied end tags |
## generate implied end tags |
| 4060 |
while ({ |
while ({ |
| 4097 |
## have an element in table scope |
## have an element in table scope |
| 4098 |
my $i; |
my $i; |
| 4099 |
my $tn; |
my $tn; |
| 4100 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: { |
| 4101 |
my $node = $self->{open_elements}->[$_]; |
for (reverse 0..$#{$self->{open_elements}}) { |
| 4102 |
if ($node->[1] eq $token->{tag_name}) { |
my $node = $self->{open_elements}->[$_]; |
| 4103 |
!!!cp ('t179'); |
if ($node->[1] eq $token->{tag_name}) { |
| 4104 |
$i = $_; |
!!!cp ('t179'); |
| 4105 |
last INSCOPE; |
$i = $_; |
| 4106 |
} elsif ($node->[1] eq 'td' or $node->[1] eq 'th') { |
|
| 4107 |
!!!cp ('t180'); |
## Close the cell |
| 4108 |
$tn = $node->[1]; |
!!!back-token; # </?> |
| 4109 |
## NOTE: There is exactly one |td| or |th| element |
$token = {type => END_TAG_TOKEN, tag_name => $tn}; |
| 4110 |
## in scope in the stack of open elements by definition. |
redo B; |
| 4111 |
} elsif ({ |
} elsif ($node->[1] eq 'td' or $node->[1] eq 'th') { |
| 4112 |
table => 1, html => 1, |
!!!cp ('t180'); |
| 4113 |
}->{$node->[1]}) { |
$tn = $node->[1]; |
| 4114 |
!!!cp ('t181'); |
## NOTE: There is exactly one |td| or |th| element |
| 4115 |
last INSCOPE; |
## in scope in the stack of open elements by definition. |
| 4116 |
|
} elsif ({ |
| 4117 |
|
table => 1, html => 1, |
| 4118 |
|
}->{$node->[1]}) { |
| 4119 |
|
## ISSUE: Can this be reached? |
| 4120 |
|
!!!cp ('t181'); |
| 4121 |
|
last; |
| 4122 |
|
} |
| 4123 |
} |
} |
| 4124 |
} # INSCOPE |
|
|
unless (defined $i) { |
|
| 4125 |
!!!cp ('t182'); |
!!!cp ('t182'); |
| 4126 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag', |
| 4127 |
|
value => $token->{tag_name}); |
| 4128 |
## Ignore the token |
## Ignore the token |
| 4129 |
!!!next-token; |
!!!next-token; |
| 4130 |
redo B; |
redo B; |
| 4131 |
} else { |
} # INSCOPE |
|
!!!cp ('t183'); |
|
|
} |
|
|
|
|
|
## Close the cell |
|
|
!!!back-token; # </?> |
|
|
$token = {type => END_TAG_TOKEN, tag_name => $tn}; |
|
|
redo B; |
|
| 4132 |
} elsif ($token->{tag_name} eq 'table' and |
} elsif ($token->{tag_name} eq 'table' and |
| 4133 |
$self->{insertion_mode} == IN_CAPTION_IM) { |
$self->{insertion_mode} == IN_CAPTION_IM) { |
| 4134 |
!!!parse-error (type => 'not closed:caption'); |
!!!parse-error (type => 'not closed:caption'); |
| 4207 |
!!!cp ('t193'); |
!!!cp ('t193'); |
| 4208 |
# |
# |
| 4209 |
} |
} |
| 4210 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 4211 |
|
for my $entry (@{$self->{open_elements}}) { |
| 4212 |
|
if (not { |
| 4213 |
|
dd => 1, dt => 1, li => 1, p => 1, tbody => 1, td => 1, tfoot => 1, |
| 4214 |
|
th => 1, thead => 1, tr => 1, body => 1, html => 1, |
| 4215 |
|
}->{$entry->[1]}) { |
| 4216 |
|
!!!cp ('t75'); |
| 4217 |
|
!!!parse-error (type => 'in body:#eof'); |
| 4218 |
|
last; |
| 4219 |
|
} |
| 4220 |
|
} |
| 4221 |
|
|
| 4222 |
|
## Stop parsing. |
| 4223 |
|
last B; |
| 4224 |
} else { |
} else { |
| 4225 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 4226 |
} |
} |
| 4534 |
redo B; |
redo B; |
| 4535 |
} |
} |
| 4536 |
|
|
| 4537 |
|
## TODO: Followings are removed from the latest spec. |
| 4538 |
## generate implied end tags |
## generate implied end tags |
| 4539 |
while ({ |
while ({ |
| 4540 |
dd => 1, dt => 1, li => 1, p => 1, |
dd => 1, dt => 1, li => 1, p => 1, |
| 4898 |
$insert = $insert_to_foster; |
$insert = $insert_to_foster; |
| 4899 |
# |
# |
| 4900 |
} |
} |
| 4901 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 4902 |
|
unless ($self->{open_elements}->[-1]->[1] eq 'html' and |
| 4903 |
|
@{$self->{open_elements}} == 1) { # redundant, maybe |
| 4904 |
|
!!!parse-error (type => 'in body:#eof'); |
| 4905 |
|
!!!cp ('t259.1'); |
| 4906 |
|
# |
| 4907 |
|
} else { |
| 4908 |
|
!!!cp ('t259.2'); |
| 4909 |
|
# |
| 4910 |
|
} |
| 4911 |
|
|
| 4912 |
|
## Stop parsing |
| 4913 |
|
last B; |
| 4914 |
} else { |
} else { |
| 4915 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 4916 |
} |
} |
| 4963 |
!!!cp ('t267'); |
!!!cp ('t267'); |
| 4964 |
# |
# |
| 4965 |
} |
} |
| 4966 |
} else { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 4967 |
die "$0: $token->{type}: Unknown token type"; |
if ($self->{open_elements}->[-1]->[1] eq 'html' or |
| 4968 |
} |
@{$self->{open_elements}} == 1) { # redundant, maybe |
| 4969 |
|
!!!cp ('t270.2'); |
| 4970 |
|
## Stop parsing. |
| 4971 |
|
last B; |
| 4972 |
|
} else { |
| 4973 |
|
## NOTE: As if </colgroup>. |
| 4974 |
|
!!!cp ('t270.1'); |
| 4975 |
|
pop @{$self->{open_elements}}; # colgroup |
| 4976 |
|
$self->{insertion_mode} = IN_TABLE_IM; |
| 4977 |
|
## Reprocess. |
| 4978 |
|
redo B; |
| 4979 |
|
} |
| 4980 |
|
} else { |
| 4981 |
|
die "$0: $token->{type}: Unknown token type"; |
| 4982 |
|
} |
| 4983 |
|
|
| 4984 |
## As if </colgroup> |
## As if </colgroup> |
| 4985 |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
| 4986 |
!!!cp ('t269'); |
!!!cp ('t269'); |
| 4987 |
|
## TODO: Wrong error type? |
| 4988 |
!!!parse-error (type => 'unmatched end tag:colgroup'); |
!!!parse-error (type => 'unmatched end tag:colgroup'); |
| 4989 |
## Ignore the token |
## Ignore the token |
| 4990 |
!!!next-token; |
!!!next-token; |
| 5220 |
!!!next-token; |
!!!next-token; |
| 5221 |
redo B; |
redo B; |
| 5222 |
} |
} |
| 5223 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5224 |
|
unless ($self->{open_elements}->[-1]->[1] eq 'html' and |
| 5225 |
|
@{$self->{open_elements}} == 1) { # redundant, maybe |
| 5226 |
|
!!!cp ('t299.1'); |
| 5227 |
|
!!!parse-error (type => 'in body:#eof'); |
| 5228 |
|
} else { |
| 5229 |
|
!!!cp ('t299.2'); |
| 5230 |
|
} |
| 5231 |
|
|
| 5232 |
|
## Stop parsing. |
| 5233 |
|
last B; |
| 5234 |
} else { |
} else { |
| 5235 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 5236 |
} |
} |
| 5314 |
## reprocess |
## reprocess |
| 5315 |
redo B; |
redo B; |
| 5316 |
} |
} |
| 5317 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5318 |
|
!!!cp ('t309.2'); |
| 5319 |
|
## Stop parsing |
| 5320 |
|
last B; |
| 5321 |
} else { |
} else { |
| 5322 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 5323 |
} |
} |
| 5453 |
!!!next-token; |
!!!next-token; |
| 5454 |
redo B; |
redo B; |
| 5455 |
} |
} |
| 5456 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5457 |
|
unless ($self->{open_elements}->[-1]->[1] eq 'html' and |
| 5458 |
|
@{$self->{open_elements}} == 1) { # redundant, maybe |
| 5459 |
|
!!!cp ('t331.1'); |
| 5460 |
|
!!!parse-error (type => 'in body:#eof'); |
| 5461 |
|
} else { |
| 5462 |
|
!!!cp ('t331.2'); |
| 5463 |
|
} |
| 5464 |
|
|
| 5465 |
|
## Stop parsing |
| 5466 |
|
last B; |
| 5467 |
} else { |
} else { |
| 5468 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 5469 |
} |
} |
| 5575 |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
| 5576 |
menu => 1, ol => 1, p => 1, ul => 1, |
menu => 1, ol => 1, p => 1, ul => 1, |
| 5577 |
pre => 1, listing => 1, |
pre => 1, listing => 1, |
| 5578 |
|
form => 1, |
| 5579 |
|
table => 1, |
| 5580 |
|
hr => 1, |
| 5581 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5582 |
|
if ($token->{tag_name} eq 'form' and defined $self->{form_element}) { |
| 5583 |
|
!!!cp ('t350'); |
| 5584 |
|
!!!parse-error (type => 'in form:form'); |
| 5585 |
|
## Ignore the token |
| 5586 |
|
!!!next-token; |
| 5587 |
|
redo B; |
| 5588 |
|
} |
| 5589 |
|
|
| 5590 |
## has a p element in scope |
## has a p element in scope |
| 5591 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 5592 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
| 5595 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
| 5596 |
redo B; |
redo B; |
| 5597 |
} elsif ({ |
} elsif ({ |
| 5598 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 5599 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 5600 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
| 5601 |
!!!cp ('t345'); |
!!!cp ('t345'); |
| 5617 |
} else { |
} else { |
| 5618 |
!!!cp ('t348'); |
!!!cp ('t348'); |
| 5619 |
} |
} |
| 5620 |
} else { |
} elsif ($token->{tag_name} eq 'form') { |
| 5621 |
!!!cp ('t347'); |
!!!cp ('t347.1'); |
| 5622 |
|
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
| 5623 |
|
|
| 5624 |
!!!next-token; |
!!!next-token; |
| 5625 |
} |
} elsif ($token->{tag_name} eq 'table') { |
| 5626 |
redo B; |
!!!cp ('t382'); |
| 5627 |
} elsif ($token->{tag_name} eq 'form') { |
push @{$open_tables}, [$self->{open_elements}->[-1]->[0]]; |
| 5628 |
if (defined $self->{form_element}) { |
|
| 5629 |
!!!cp ('t350'); |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5630 |
!!!parse-error (type => 'in form:form'); |
|
| 5631 |
## Ignore the token |
!!!next-token; |
| 5632 |
|
} elsif ($token->{tag_name} eq 'hr') { |
| 5633 |
|
!!!cp ('t386'); |
| 5634 |
|
pop @{$self->{open_elements}}; |
| 5635 |
|
|
| 5636 |
!!!next-token; |
!!!next-token; |
|
redo B; |
|
| 5637 |
} else { |
} else { |
| 5638 |
## has a p element in scope |
!!!cp ('t347'); |
|
INSCOPE: for (reverse @{$self->{open_elements}}) { |
|
|
if ($_->[1] eq 'p') { |
|
|
!!!cp ('t351'); |
|
|
!!!back-token; |
|
|
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
|
!!!cp ('t352'); |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
|
| 5639 |
!!!next-token; |
!!!next-token; |
|
redo B; |
|
| 5640 |
} |
} |
| 5641 |
} elsif ($token->{tag_name} eq 'li') { |
redo B; |
| 5642 |
|
} elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) { |
| 5643 |
## has a p element in scope |
## has a p element in scope |
| 5644 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 5645 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
| 5648 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
| 5649 |
redo B; |
redo B; |
| 5650 |
} elsif ({ |
} elsif ({ |
| 5651 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 5652 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 5653 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
| 5654 |
!!!cp ('t354'); |
!!!cp ('t354'); |
| 5659 |
## Step 1 |
## Step 1 |
| 5660 |
my $i = -1; |
my $i = -1; |
| 5661 |
my $node = $self->{open_elements}->[$i]; |
my $node = $self->{open_elements}->[$i]; |
| 5662 |
|
my $li_or_dtdd = {li => {li => 1}, |
| 5663 |
|
dt => {dt => 1, dd => 1}, |
| 5664 |
|
dd => {dt => 1, dd => 1}}->{$token->{tag_name}}; |
| 5665 |
LI: { |
LI: { |
| 5666 |
## Step 2 |
## Step 2 |
| 5667 |
if ($node->[1] eq 'li') { |
if ($li_or_dtdd->{$node->[1]}) { |
| 5668 |
if ($i != -1) { |
if ($i != -1) { |
| 5669 |
!!!cp ('t355'); |
!!!cp ('t355'); |
| 5670 |
!!!parse-error (type => 'end tag missing:'. |
!!!parse-error (type => 'end tag missing:'. |
| 5698 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
| 5699 |
!!!next-token; |
!!!next-token; |
| 5700 |
redo B; |
redo B; |
|
} elsif ($token->{tag_name} eq 'dd' or $token->{tag_name} eq 'dt') { |
|
|
## has a p element in scope |
|
|
INSCOPE: for (reverse @{$self->{open_elements}}) { |
|
|
if ($_->[1] eq 'p') { |
|
|
!!!cp ('t360'); |
|
|
!!!back-token; |
|
|
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
|
!!!cp ('t361'); |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
|
|
|
## Step 1 |
|
|
my $i = -1; |
|
|
my $node = $self->{open_elements}->[$i]; |
|
|
LI: { |
|
|
## Step 2 |
|
|
if ($node->[1] eq 'dt' or $node->[1] eq 'dd') { |
|
|
if ($i != -1) { |
|
|
!!!cp ('t362'); |
|
|
!!!parse-error (type => 'end tag missing:'. |
|
|
$self->{open_elements}->[-1]->[1]); |
|
|
} else { |
|
|
!!!cp ('t363'); |
|
|
} |
|
|
splice @{$self->{open_elements}}, $i; |
|
|
last LI; |
|
|
} else { |
|
|
!!!cp ('t364'); |
|
|
} |
|
|
|
|
|
## Step 3 |
|
|
if (not $formatting_category->{$node->[1]} and |
|
|
#not $phrasing_category->{$node->[1]} and |
|
|
($special_category->{$node->[1]} or |
|
|
$scoping_category->{$node->[1]}) and |
|
|
$node->[1] ne 'address' and $node->[1] ne 'div') { |
|
|
!!!cp ('t365'); |
|
|
last LI; |
|
|
} |
|
|
|
|
|
!!!cp ('t366'); |
|
|
## Step 4 |
|
|
$i--; |
|
|
$node = $self->{open_elements}->[$i]; |
|
|
redo LI; |
|
|
} # LI |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 5701 |
} elsif ($token->{tag_name} eq 'plaintext') { |
} elsif ($token->{tag_name} eq 'plaintext') { |
| 5702 |
## has a p element in scope |
## has a p element in scope |
| 5703 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 5707 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
| 5708 |
redo B; |
redo B; |
| 5709 |
} elsif ({ |
} elsif ({ |
| 5710 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 5711 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 5712 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
| 5713 |
!!!cp ('t368'); |
!!!cp ('t368'); |
| 5760 |
|
|
| 5761 |
!!!next-token; |
!!!next-token; |
| 5762 |
redo B; |
redo B; |
|
} elsif ({ |
|
|
b => 1, big => 1, em => 1, font => 1, i => 1, |
|
|
s => 1, small => 1, strile => 1, |
|
|
strong => 1, tt => 1, u => 1, |
|
|
}->{$token->{tag_name}}) { |
|
|
!!!cp ('t375'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
| 5763 |
} elsif ($token->{tag_name} eq 'nobr') { |
} elsif ($token->{tag_name} eq 'nobr') { |
| 5764 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 5765 |
|
|
| 5773 |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr'}; |
| 5774 |
redo B; |
redo B; |
| 5775 |
} elsif ({ |
} elsif ({ |
| 5776 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 5777 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 5778 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
| 5779 |
!!!cp ('t377'); |
!!!cp ('t377'); |
| 5797 |
$token = {type => END_TAG_TOKEN, tag_name => 'button'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'button'}; |
| 5798 |
redo B; |
redo B; |
| 5799 |
} elsif ({ |
} elsif ({ |
| 5800 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 5801 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 5802 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
| 5803 |
!!!cp ('t379'); |
!!!cp ('t379'); |
| 5815 |
|
|
| 5816 |
!!!next-token; |
!!!next-token; |
| 5817 |
redo B; |
redo B; |
|
} elsif ($token->{tag_name} eq 'marquee' or |
|
|
$token->{tag_name} eq 'object') { |
|
|
!!!cp ('t380'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
push @$active_formatting_elements, ['#marker', '']; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'xmp') { |
|
|
!!!cp ('t381'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
$parse_rcdata->(CDATA_CONTENT_MODEL); |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'table') { |
|
|
## has a p element in scope |
|
|
INSCOPE: for (reverse @{$self->{open_elements}}) { |
|
|
if ($_->[1] eq 'p') { |
|
|
!!!cp ('t382'); |
|
|
!!!back-token; |
|
|
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
|
!!!cp ('t383'); |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
push @{$open_tables}, [$self->{open_elements}->[-1]->[0]]; |
|
|
|
|
|
$self->{insertion_mode} = IN_TABLE_IM; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
| 5818 |
} elsif ({ |
} elsif ({ |
| 5819 |
area => 1, basefont => 1, bgsound => 1, br => 1, |
xmp => 1, |
| 5820 |
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
iframe => 1, |
| 5821 |
image => 1, |
noembed => 1, |
| 5822 |
|
noframes => 1, |
| 5823 |
|
noscript => 0, ## TODO: 1 if scripting is enabled |
| 5824 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5825 |
if ($token->{tag_name} eq 'image') { |
if ($token->{tag_name} eq 'xmp') { |
| 5826 |
!!!cp ('t384'); |
!!!cp ('t381'); |
| 5827 |
!!!parse-error (type => 'image'); |
$reconstruct_active_formatting_elements->($insert_to_current); |
|
$token->{tag_name} = 'img'; |
|
| 5828 |
} else { |
} else { |
| 5829 |
!!!cp ('t385'); |
!!!cp ('t399'); |
| 5830 |
} |
} |
| 5831 |
|
## NOTE: There is an "as if in body" code clone. |
| 5832 |
## NOTE: There is an "as if <br>" code clone. |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
pop @{$self->{open_elements}}; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'hr') { |
|
|
## has a p element in scope |
|
|
INSCOPE: for (reverse @{$self->{open_elements}}) { |
|
|
if ($_->[1] eq 'p') { |
|
|
!!!cp ('t386'); |
|
|
!!!back-token; |
|
|
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
|
!!!cp ('t387'); |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
pop @{$self->{open_elements}}; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'input') { |
|
|
!!!cp ('t388'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
## TODO: associate with $self->{form_element} if defined |
|
|
pop @{$self->{open_elements}}; |
|
|
|
|
|
!!!next-token; |
|
| 5833 |
redo B; |
redo B; |
| 5834 |
} elsif ($token->{tag_name} eq 'isindex') { |
} elsif ($token->{tag_name} eq 'isindex') { |
| 5835 |
!!!parse-error (type => 'isindex'); |
!!!parse-error (type => 'isindex'); |
| 5921 |
!!!next-token; |
!!!next-token; |
| 5922 |
redo B; |
redo B; |
| 5923 |
} elsif ({ |
} elsif ({ |
|
iframe => 1, |
|
|
noembed => 1, |
|
|
noframes => 1, |
|
|
noscript => 0, ## TODO: 1 if scripting is enabled |
|
|
}->{$token->{tag_name}}) { |
|
|
!!!cp ('t399'); |
|
|
## NOTE: There is an "as if in body" code clone. |
|
|
$parse_rcdata->(CDATA_CONTENT_MODEL); |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'select') { |
|
|
!!!cp ('t400'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
|
|
|
## TODO: associate with $self->{form_element} if defined |
|
|
|
|
|
if ($self->{insertion_mode} & TABLE_IMS or |
|
|
$self->{insertion_mode} & BODY_TABLE_IMS or |
|
|
$self->{insertion_mode} == IN_COLUMN_GROUP_IM) { |
|
|
!!!cp ('t400.1'); |
|
|
$self->{insertion_mode} = IN_SELECT_IN_TABLE_IM; |
|
|
} else { |
|
|
!!!cp ('t400.2'); |
|
|
$self->{insertion_mode} = IN_SELECT_IM; |
|
|
} |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ({ |
|
| 5924 |
caption => 1, col => 1, colgroup => 1, frame => 1, |
caption => 1, col => 1, colgroup => 1, frame => 1, |
| 5925 |
frameset => 1, head => 1, option => 1, optgroup => 1, |
frameset => 1, head => 1, option => 1, optgroup => 1, |
| 5926 |
tbody => 1, td => 1, tfoot => 1, th => 1, |
tbody => 1, td => 1, tfoot => 1, th => 1, |
| 5934 |
|
|
| 5935 |
## ISSUE: An issue on HTML5 new elements in the spec. |
## ISSUE: An issue on HTML5 new elements in the spec. |
| 5936 |
} else { |
} else { |
| 5937 |
!!!cp ('t402'); |
if ($token->{tag_name} eq 'image') { |
| 5938 |
|
!!!cp ('t384'); |
| 5939 |
|
!!!parse-error (type => 'image'); |
| 5940 |
|
$token->{tag_name} = 'img'; |
| 5941 |
|
} else { |
| 5942 |
|
!!!cp ('t385'); |
| 5943 |
|
} |
| 5944 |
|
|
| 5945 |
|
## NOTE: There is an "as if <br>" code clone. |
| 5946 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 5947 |
|
|
| 5948 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
| 5949 |
|
|
| 5950 |
|
if ({ |
| 5951 |
|
applet => 1, marquee => 1, object => 1, |
| 5952 |
|
}->{$token->{tag_name}}) { |
| 5953 |
|
!!!cp ('t380'); |
| 5954 |
|
push @$active_formatting_elements, ['#marker', '']; |
| 5955 |
|
} elsif ({ |
| 5956 |
|
b => 1, big => 1, em => 1, font => 1, i => 1, |
| 5957 |
|
s => 1, small => 1, strile => 1, |
| 5958 |
|
strong => 1, tt => 1, u => 1, |
| 5959 |
|
}->{$token->{tag_name}}) { |
| 5960 |
|
!!!cp ('t375'); |
| 5961 |
|
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
| 5962 |
|
} elsif ($token->{tag_name} eq 'input') { |
| 5963 |
|
!!!cp ('t388'); |
| 5964 |
|
## TODO: associate with $self->{form_element} if defined |
| 5965 |
|
pop @{$self->{open_elements}}; |
| 5966 |
|
} elsif ({ |
| 5967 |
|
area => 1, basefont => 1, bgsound => 1, br => 1, |
| 5968 |
|
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
| 5969 |
|
#image => 1, |
| 5970 |
|
}->{$token->{tag_name}}) { |
| 5971 |
|
!!!cp ('t388.1'); |
| 5972 |
|
pop @{$self->{open_elements}}; |
| 5973 |
|
} elsif ($token->{tag_name} eq 'select') { |
| 5974 |
|
## TODO: associate with $self->{form_element} if defined |
| 5975 |
|
|
| 5976 |
|
if ($self->{insertion_mode} & TABLE_IMS or |
| 5977 |
|
$self->{insertion_mode} & BODY_TABLE_IMS or |
| 5978 |
|
$self->{insertion_mode} == IN_COLUMN_GROUP_IM) { |
| 5979 |
|
!!!cp ('t400.1'); |
| 5980 |
|
$self->{insertion_mode} = IN_SELECT_IN_TABLE_IM; |
| 5981 |
|
} else { |
| 5982 |
|
!!!cp ('t400.2'); |
| 5983 |
|
$self->{insertion_mode} = IN_SELECT_IM; |
| 5984 |
|
} |
| 5985 |
|
} else { |
| 5986 |
|
!!!cp ('t402'); |
| 5987 |
|
} |
| 5988 |
|
|
| 5989 |
!!!next-token; |
!!!next-token; |
| 5990 |
redo B; |
redo B; |
| 5991 |
} |
} |
| 5992 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 5993 |
if ($token->{tag_name} eq 'body') { |
if ($token->{tag_name} eq 'body') { |
| 5994 |
if (@{$self->{open_elements}} > 1 and |
## has a |body| element in scope |
| 5995 |
$self->{open_elements}->[1]->[1] eq 'body') { |
my $i; |
| 5996 |
for (@{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 5997 |
unless ({ |
if ($_->[1] eq 'body') { |
| 5998 |
dd => 1, dt => 1, li => 1, p => 1, td => 1, |
!!!cp ('t405'); |
| 5999 |
th => 1, tr => 1, body => 1, html => 1, |
$i = $_; |
| 6000 |
tbody => 1, tfoot => 1, thead => 1, |
last INSCOPE; |
| 6001 |
}->{$_->[1]}) { |
} elsif ({ |
| 6002 |
!!!cp ('t403'); |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 6003 |
!!!parse-error (type => 'not closed:'.$_->[1]); |
button => 1, marquee => 1, object => 1, html => 1, |
| 6004 |
} else { |
}->{$_->[1]}) { |
| 6005 |
!!!cp ('t404'); |
!!!cp ('t405.1'); |
| 6006 |
} |
last INSCOPE; |
| 6007 |
} |
} |
| 6008 |
|
} # INSCOPE |
| 6009 |
$self->{insertion_mode} = AFTER_BODY_IM; |
unless (defined $i) { |
|
!!!next-token; |
|
|
redo B; |
|
|
} else { |
|
|
!!!cp ('t405'); |
|
| 6010 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
| 6011 |
## Ignore the token |
## NOTE: Ignore the token. |
| 6012 |
!!!next-token; |
!!!next-token; |
| 6013 |
redo B; |
redo B; |
| 6014 |
} |
} |
| 6015 |
|
|
| 6016 |
|
for (@{$self->{open_elements}}) { |
| 6017 |
|
unless ({ |
| 6018 |
|
dd => 1, dt => 1, li => 1, p => 1, td => 1, |
| 6019 |
|
th => 1, tr => 1, body => 1, html => 1, |
| 6020 |
|
tbody => 1, tfoot => 1, thead => 1, |
| 6021 |
|
}->{$_->[1]}) { |
| 6022 |
|
!!!cp ('t403'); |
| 6023 |
|
!!!parse-error (type => 'not closed:'.$_->[1]); |
| 6024 |
|
last; |
| 6025 |
|
} else { |
| 6026 |
|
!!!cp ('t404'); |
| 6027 |
|
} |
| 6028 |
|
} |
| 6029 |
|
|
| 6030 |
|
$self->{insertion_mode} = AFTER_BODY_IM; |
| 6031 |
|
!!!next-token; |
| 6032 |
|
redo B; |
| 6033 |
} elsif ($token->{tag_name} eq 'html') { |
} elsif ($token->{tag_name} eq 'html') { |
| 6034 |
if (@{$self->{open_elements}} > 1 and $self->{open_elements}->[1]->[1] eq 'body') { |
if (@{$self->{open_elements}} > 1 and $self->{open_elements}->[1]->[1] eq 'body') { |
| 6035 |
## ISSUE: There is an issue in the spec. |
## ISSUE: There is an issue in the spec. |
| 6054 |
div => 1, dl => 1, fieldset => 1, listing => 1, |
div => 1, dl => 1, fieldset => 1, listing => 1, |
| 6055 |
menu => 1, ol => 1, pre => 1, ul => 1, |
menu => 1, ol => 1, pre => 1, ul => 1, |
| 6056 |
dd => 1, dt => 1, li => 1, |
dd => 1, dt => 1, li => 1, |
| 6057 |
button => 1, marquee => 1, object => 1, |
applet => 1, button => 1, marquee => 1, object => 1, |
| 6058 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6059 |
## has an element in scope |
## has an element in scope |
| 6060 |
my $i; |
my $i; |
| 6065 |
$i = $_; |
$i = $_; |
| 6066 |
last INSCOPE; |
last INSCOPE; |
| 6067 |
} elsif ({ |
} elsif ({ |
| 6068 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 6069 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 6070 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
| 6071 |
!!!cp ('t411'); |
!!!cp ('t411'); |
| 6102 |
## Step 4. |
## Step 4. |
| 6103 |
$clear_up_to_marker->() |
$clear_up_to_marker->() |
| 6104 |
if { |
if { |
| 6105 |
button => 1, marquee => 1, object => 1, |
applet => 1, button => 1, marquee => 1, object => 1, |
| 6106 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
| 6107 |
} |
} |
| 6108 |
!!!next-token; |
!!!next-token; |
| 6119 |
$i = $_; |
$i = $_; |
| 6120 |
last INSCOPE; |
last INSCOPE; |
| 6121 |
} elsif ({ |
} elsif ({ |
| 6122 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 6123 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 6124 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
| 6125 |
!!!cp ('t419'); |
!!!cp ('t419'); |
| 6167 |
$i = $_; |
$i = $_; |
| 6168 |
last INSCOPE; |
last INSCOPE; |
| 6169 |
} elsif ({ |
} elsif ({ |
| 6170 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 6171 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 6172 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
| 6173 |
!!!cp ('t424'); |
!!!cp ('t424'); |
| 6211 |
$i = $_; |
$i = $_; |
| 6212 |
last INSCOPE; |
last INSCOPE; |
| 6213 |
} elsif ({ |
} elsif ({ |
| 6214 |
table => 1, caption => 1, td => 1, th => 1, |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
| 6215 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
| 6216 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
| 6217 |
!!!cp ('t411.1'); |
!!!cp ('t411.1'); |