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) { |
4208 |
!!!cp ('t193'); |
!!!cp ('t193'); |
4209 |
# |
# |
4210 |
} |
} |
4211 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
4212 |
|
for my $entry (@{$self->{open_elements}}) { |
4213 |
|
if (not { |
4214 |
|
dd => 1, dt => 1, li => 1, p => 1, tbody => 1, td => 1, tfoot => 1, |
4215 |
|
th => 1, thead => 1, tr => 1, body => 1, html => 1, |
4216 |
|
}->{$entry->[1]}) { |
4217 |
|
!!!cp ('t75'); |
4218 |
|
!!!parse-error (type => 'in body:#eof'); |
4219 |
|
last; |
4220 |
|
} |
4221 |
|
} |
4222 |
|
|
4223 |
|
## Stop parsing. |
4224 |
|
last B; |
4225 |
} else { |
} else { |
4226 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
4227 |
} |
} |
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 |
|
!!!cp ('t259.1'); |
4905 |
|
!!!parse-error (type => 'in body:#eof'); |
4906 |
|
} else { |
4907 |
|
!!!cp ('t259.2'); |
4908 |
|
} |
4909 |
|
|
4910 |
|
## Stop parsing |
4911 |
|
last B; |
4912 |
} else { |
} else { |
4913 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
4914 |
} |
} |
4961 |
!!!cp ('t267'); |
!!!cp ('t267'); |
4962 |
# |
# |
4963 |
} |
} |
4964 |
} else { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
4965 |
die "$0: $token->{type}: Unknown token type"; |
if ($self->{open_elements}->[-1]->[1] eq 'html' or |
4966 |
} |
@{$self->{open_elements}} == 1) { # redundant, maybe |
4967 |
|
!!!cp ('t270.2'); |
4968 |
|
## Stop parsing. |
4969 |
|
last B; |
4970 |
|
} else { |
4971 |
|
## NOTE: As if </colgroup>. |
4972 |
|
!!!cp ('t270.1'); |
4973 |
|
pop @{$self->{open_elements}}; # colgroup |
4974 |
|
$self->{insertion_mode} = IN_TABLE_IM; |
4975 |
|
## Reprocess. |
4976 |
|
redo B; |
4977 |
|
} |
4978 |
|
} else { |
4979 |
|
die "$0: $token->{type}: Unknown token type"; |
4980 |
|
} |
4981 |
|
|
4982 |
## As if </colgroup> |
## As if </colgroup> |
4983 |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
4984 |
!!!cp ('t269'); |
!!!cp ('t269'); |
4985 |
|
## TODO: Wrong error type? |
4986 |
!!!parse-error (type => 'unmatched end tag:colgroup'); |
!!!parse-error (type => 'unmatched end tag:colgroup'); |
4987 |
## Ignore the token |
## Ignore the token |
4988 |
!!!next-token; |
!!!next-token; |
5218 |
!!!next-token; |
!!!next-token; |
5219 |
redo B; |
redo B; |
5220 |
} |
} |
5221 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
5222 |
|
unless ($self->{open_elements}->[-1]->[1] eq 'html' and |
5223 |
|
@{$self->{open_elements}} == 1) { # redundant, maybe |
5224 |
|
!!!cp ('t299.1'); |
5225 |
|
!!!parse-error (type => 'in body:#eof'); |
5226 |
|
} else { |
5227 |
|
!!!cp ('t299.2'); |
5228 |
|
} |
5229 |
|
|
5230 |
|
## Stop parsing. |
5231 |
|
last B; |
5232 |
} else { |
} else { |
5233 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
5234 |
} |
} |
5312 |
## reprocess |
## reprocess |
5313 |
redo B; |
redo B; |
5314 |
} |
} |
5315 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
5316 |
|
!!!cp ('t309.2'); |
5317 |
|
## Stop parsing |
5318 |
|
last B; |
5319 |
} else { |
} else { |
5320 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
5321 |
} |
} |
5451 |
!!!next-token; |
!!!next-token; |
5452 |
redo B; |
redo B; |
5453 |
} |
} |
5454 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
5455 |
|
unless ($self->{open_elements}->[-1]->[1] eq 'html' and |
5456 |
|
@{$self->{open_elements}} == 1) { # redundant, maybe |
5457 |
|
!!!cp ('t331.1'); |
5458 |
|
!!!parse-error (type => 'in body:#eof'); |
5459 |
|
} else { |
5460 |
|
!!!cp ('t331.2'); |
5461 |
|
} |
5462 |
|
|
5463 |
|
## Stop parsing |
5464 |
|
last B; |
5465 |
} else { |
} else { |
5466 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
5467 |
} |
} |