3970 |
|
|
3971 |
$in_body->($insert_to_current); |
$in_body->($insert_to_current); |
3972 |
redo B; |
redo B; |
3973 |
} elsif ($self->{insertion_mode} eq 'in table body' or |
} elsif ($self->{insertion_mode} eq 'in row' or |
3974 |
|
$self->{insertion_mode} eq 'in table body' or |
3975 |
$self->{insertion_mode} eq 'in table') { |
$self->{insertion_mode} eq 'in table') { |
3976 |
if ($token->{type} eq 'character') { |
if ($token->{type} eq 'character') { |
3977 |
## NOTE: There are "character in table" code clones. |
## NOTE: There are "character in table" code clones. |
4033 |
redo B; |
redo B; |
4034 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
4035 |
if ({ |
if ({ |
4036 |
tr => 1, |
tr => ($self->{insertion_mode} ne 'in row'), |
4037 |
th => 1, td => 1, |
th => 1, td => 1, |
4038 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4039 |
if ($self->{insertion_mode} eq 'in table') { |
if ($self->{insertion_mode} eq 'in table') { |
4049 |
## reprocess in the "in table body" insertion mode... |
## reprocess in the "in table body" insertion mode... |
4050 |
} |
} |
4051 |
|
|
4052 |
unless ($token->{tag_name} eq 'tr') { |
if ($self->{insertion_mode} eq 'in table body') { |
4053 |
!!!parse-error (type => 'missing start tag:tr'); |
unless ($token->{tag_name} eq 'tr') { |
4054 |
|
!!!parse-error (type => 'missing start tag:tr'); |
4055 |
|
} |
4056 |
|
|
4057 |
|
## Clear back to table body context |
4058 |
|
while (not { |
4059 |
|
tbody => 1, tfoot => 1, thead => 1, html => 1, |
4060 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4061 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4062 |
|
pop @{$self->{open_elements}}; |
4063 |
|
} |
4064 |
|
|
4065 |
|
$self->{insertion_mode} = 'in row'; |
4066 |
|
if ($token->{tag_name} eq 'tr') { |
4067 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4068 |
|
!!!next-token; |
4069 |
|
redo B; |
4070 |
|
} else { |
4071 |
|
!!!insert-element ('tr'); |
4072 |
|
## reprocess in the "in row" insertion mode |
4073 |
|
} |
4074 |
} |
} |
4075 |
|
|
4076 |
## Clear back to table body context |
## Clear back to table row context |
4077 |
while (not { |
while (not { |
4078 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
tr => 1, html => 1, |
4079 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4080 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4081 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4082 |
} |
} |
4083 |
|
|
4084 |
$self->{insertion_mode} = 'in row'; |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4085 |
if ($token->{tag_name} eq 'tr') { |
$self->{insertion_mode} = 'in cell'; |
4086 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
|
4087 |
|
push @$active_formatting_elements, ['#marker', '']; |
4088 |
|
|
4089 |
|
!!!next-token; |
4090 |
|
redo B; |
4091 |
|
} elsif ({ |
4092 |
|
caption => 1, col => 1, colgroup => 1, |
4093 |
|
tbody => 1, tfoot => 1, thead => 1, tr => 1, |
4094 |
|
}->{$token->{tag_name}} and |
4095 |
|
$self->{insertion_mode} eq 'in row') { |
4096 |
|
## As if </tr> |
4097 |
|
## have an element in table scope |
4098 |
|
my $i; |
4099 |
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4100 |
|
my $node = $self->{open_elements}->[$_]; |
4101 |
|
if ($node->[1] eq 'tr') { |
4102 |
|
$i = $_; |
4103 |
|
last INSCOPE; |
4104 |
|
} elsif ({ |
4105 |
|
table => 1, html => 1, |
4106 |
|
}->{$node->[1]}) { |
4107 |
|
last INSCOPE; |
4108 |
|
} |
4109 |
|
} # INSCOPE |
4110 |
|
unless (defined $i) { |
4111 |
|
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}); |
4112 |
|
## Ignore the token |
4113 |
!!!next-token; |
!!!next-token; |
4114 |
} else { |
redo B; |
4115 |
!!!insert-element ('tr'); |
} |
4116 |
## reprocess |
|
4117 |
|
## Clear back to table row context |
4118 |
|
while (not { |
4119 |
|
tr => 1, html => 1, |
4120 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4121 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4122 |
|
pop @{$self->{open_elements}}; |
4123 |
} |
} |
4124 |
|
|
4125 |
|
pop @{$self->{open_elements}}; # tr |
4126 |
|
$self->{insertion_mode} = 'in table body'; |
4127 |
|
## reprocess |
4128 |
redo B; |
redo B; |
4129 |
} elsif ({ |
} elsif ({ |
4130 |
caption => 1, col => 1, colgroup => 1, |
caption => 1, col => 1, colgroup => 1, |
4264 |
# |
# |
4265 |
} |
} |
4266 |
} elsif ($token->{type} eq 'end tag') { |
} elsif ($token->{type} eq 'end tag') { |
4267 |
if ($token->{tag_name} eq 'table') { |
if ($token->{tag_name} eq 'tr' and |
4268 |
|
$self->{insertion_mode} eq 'in row') { |
4269 |
|
## have an element in table scope |
4270 |
|
my $i; |
4271 |
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4272 |
|
my $node = $self->{open_elements}->[$_]; |
4273 |
|
if ($node->[1] eq $token->{tag_name}) { |
4274 |
|
$i = $_; |
4275 |
|
last INSCOPE; |
4276 |
|
} elsif ({ |
4277 |
|
table => 1, html => 1, |
4278 |
|
}->{$node->[1]}) { |
4279 |
|
last INSCOPE; |
4280 |
|
} |
4281 |
|
} # INSCOPE |
4282 |
|
unless (defined $i) { |
4283 |
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4284 |
|
## Ignore the token |
4285 |
|
!!!next-token; |
4286 |
|
redo B; |
4287 |
|
} |
4288 |
|
|
4289 |
|
## Clear back to table row context |
4290 |
|
while (not { |
4291 |
|
tr => 1, html => 1, |
4292 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4293 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4294 |
|
pop @{$self->{open_elements}}; |
4295 |
|
} |
4296 |
|
|
4297 |
|
pop @{$self->{open_elements}}; # tr |
4298 |
|
$self->{insertion_mode} = 'in table body'; |
4299 |
|
!!!next-token; |
4300 |
|
redo B; |
4301 |
|
} elsif ($token->{tag_name} eq 'table') { |
4302 |
|
if ($self->{insertion_mode} eq 'in row') { |
4303 |
|
## As if </tr> |
4304 |
|
## have an element in table scope |
4305 |
|
my $i; |
4306 |
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4307 |
|
my $node = $self->{open_elements}->[$_]; |
4308 |
|
if ($node->[1] eq 'tr') { |
4309 |
|
$i = $_; |
4310 |
|
last INSCOPE; |
4311 |
|
} elsif ({ |
4312 |
|
table => 1, html => 1, |
4313 |
|
}->{$node->[1]}) { |
4314 |
|
last INSCOPE; |
4315 |
|
} |
4316 |
|
} # INSCOPE |
4317 |
|
unless (defined $i) { |
4318 |
|
!!!parse-error (type => 'unmatched end tag:'.$token->{type}); |
4319 |
|
## Ignore the token |
4320 |
|
!!!next-token; |
4321 |
|
redo B; |
4322 |
|
} |
4323 |
|
|
4324 |
|
## Clear back to table row context |
4325 |
|
while (not { |
4326 |
|
tr => 1, html => 1, |
4327 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4328 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4329 |
|
pop @{$self->{open_elements}}; |
4330 |
|
} |
4331 |
|
|
4332 |
|
pop @{$self->{open_elements}}; # tr |
4333 |
|
$self->{insertion_mode} = 'in table body'; |
4334 |
|
## reprocess in the "in table body" insertion mode... |
4335 |
|
} |
4336 |
|
|
4337 |
if ($self->{insertion_mode} eq 'in table body') { |
if ($self->{insertion_mode} eq 'in table body') { |
4338 |
## have an element in table scope |
## have an element in table scope |
4339 |
my $i; |
my $i; |
4422 |
} elsif ({ |
} elsif ({ |
4423 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
4424 |
}->{$token->{tag_name}} and |
}->{$token->{tag_name}} and |
4425 |
$self->{insertion_mode} eq 'in table body') { |
($self->{insertion_mode} eq 'in row' or |
4426 |
|
$self->{insertion_mode} eq 'in table body')) { |
4427 |
|
if ($self->{insertion_mode} eq 'in row') { |
4428 |
|
## have an element in table scope |
4429 |
|
my $i; |
4430 |
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4431 |
|
my $node = $self->{open_elements}->[$_]; |
4432 |
|
if ($node->[1] eq $token->{tag_name}) { |
4433 |
|
$i = $_; |
4434 |
|
last INSCOPE; |
4435 |
|
} elsif ({ |
4436 |
|
table => 1, html => 1, |
4437 |
|
}->{$node->[1]}) { |
4438 |
|
last INSCOPE; |
4439 |
|
} |
4440 |
|
} # INSCOPE |
4441 |
|
unless (defined $i) { |
4442 |
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4443 |
|
## Ignore the token |
4444 |
|
!!!next-token; |
4445 |
|
redo B; |
4446 |
|
} |
4447 |
|
|
4448 |
|
## As if </tr> |
4449 |
|
## have an element in table scope |
4450 |
|
my $i; |
4451 |
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4452 |
|
my $node = $self->{open_elements}->[$_]; |
4453 |
|
if ($node->[1] eq 'tr') { |
4454 |
|
$i = $_; |
4455 |
|
last INSCOPE; |
4456 |
|
} elsif ({ |
4457 |
|
table => 1, html => 1, |
4458 |
|
}->{$node->[1]}) { |
4459 |
|
last INSCOPE; |
4460 |
|
} |
4461 |
|
} # INSCOPE |
4462 |
|
unless (defined $i) { |
4463 |
|
!!!parse-error (type => 'unmatched end tag:tr'); |
4464 |
|
## Ignore the token |
4465 |
|
!!!next-token; |
4466 |
|
redo B; |
4467 |
|
} |
4468 |
|
|
4469 |
|
## Clear back to table row context |
4470 |
|
while (not { |
4471 |
|
tr => 1, html => 1, |
4472 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4473 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4474 |
|
pop @{$self->{open_elements}}; |
4475 |
|
} |
4476 |
|
|
4477 |
|
pop @{$self->{open_elements}}; # tr |
4478 |
|
$self->{insertion_mode} = 'in table body'; |
4479 |
|
## reprocess in the "in table body" insertion mode... |
4480 |
|
} |
4481 |
|
|
4482 |
## have an element in table scope |
## have an element in table scope |
4483 |
my $i; |
my $i; |
4484 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4513 |
redo B; |
redo B; |
4514 |
} elsif ({ |
} elsif ({ |
4515 |
body => 1, caption => 1, col => 1, colgroup => 1, |
body => 1, caption => 1, col => 1, colgroup => 1, |
4516 |
html => 1, td => 1, th => 1, tr => 1, |
html => 1, td => 1, th => 1, |
4517 |
|
tr => 1, # $self->{insertion_mode} eq 'in row' |
4518 |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} eq 'in table' |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} eq 'in table' |
4519 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4520 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4588 |
## reprocess |
## reprocess |
4589 |
redo B; |
redo B; |
4590 |
} |
} |
|
} elsif ($self->{insertion_mode} eq 'in row') { |
|
|
if ($token->{type} eq 'character') { |
|
|
## NOTE: This is a "character in table" code clone. |
|
|
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
|
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
|
|
|
|
|
unless (length $token->{data}) { |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
} |
|
|
|
|
|
!!!parse-error (type => 'in table:#character'); |
|
|
|
|
|
## As if in body, but insert into foster parent element |
|
|
## ISSUE: Spec says that "whenever a node would be inserted |
|
|
## into the current node" while characters might not be |
|
|
## result in a new Text node. |
|
|
$reconstruct_active_formatting_elements->($insert_to_foster); |
|
|
|
|
|
if ({ |
|
|
table => 1, tbody => 1, tfoot => 1, |
|
|
thead => 1, tr => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
# MUST |
|
|
my $foster_parent_element; |
|
|
my $next_sibling; |
|
|
my $prev_sibling; |
|
|
OE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
|
|
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
|
|
if (defined $parent and $parent->node_type == 1) { |
|
|
$foster_parent_element = $parent; |
|
|
$next_sibling = $self->{open_elements}->[$_]->[0]; |
|
|
$prev_sibling = $next_sibling->previous_sibling; |
|
|
} else { |
|
|
$foster_parent_element = $self->{open_elements}->[$_ - 1]->[0]; |
|
|
$prev_sibling = $foster_parent_element->last_child; |
|
|
} |
|
|
last OE; |
|
|
} |
|
|
} # OE |
|
|
$foster_parent_element = $self->{open_elements}->[0]->[0] and |
|
|
$prev_sibling = $foster_parent_element->last_child |
|
|
unless defined $foster_parent_element; |
|
|
if (defined $prev_sibling and |
|
|
$prev_sibling->node_type == 3) { |
|
|
$prev_sibling->manakai_append_text ($token->{data}); |
|
|
} else { |
|
|
$foster_parent_element->insert_before |
|
|
($self->{document}->create_text_node ($token->{data}), |
|
|
$next_sibling); |
|
|
} |
|
|
} else { |
|
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
|
|
} |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{type} eq 'start tag') { |
|
|
if ($token->{tag_name} eq 'th' or |
|
|
$token->{tag_name} eq 'td') { |
|
|
## Clear back to table row context |
|
|
while (not { |
|
|
tr => 1, html => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
pop @{$self->{open_elements}}; |
|
|
} |
|
|
|
|
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
|
|
$self->{insertion_mode} = 'in cell'; |
|
|
|
|
|
push @$active_formatting_elements, ['#marker', '']; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
caption => 1, col => 1, colgroup => 1, |
|
|
tbody => 1, tfoot => 1, thead => 1, tr => 1, |
|
|
}->{$token->{tag_name}}) { |
|
|
## As if </tr> |
|
|
## have an element in table scope |
|
|
my $i; |
|
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
my $node = $self->{open_elements}->[$_]; |
|
|
if ($node->[1] eq 'tr') { |
|
|
$i = $_; |
|
|
last INSCOPE; |
|
|
} elsif ({ |
|
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
unless (defined $i) { |
|
|
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
|
|
|
## Clear back to table row context |
|
|
while (not { |
|
|
tr => 1, html => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
pop @{$self->{open_elements}}; |
|
|
} |
|
|
|
|
|
pop @{$self->{open_elements}}; # tr |
|
|
$self->{insertion_mode} = 'in table body'; |
|
|
## reprocess |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'table') { |
|
|
## NOTE: This is a code clone of "table in table" |
|
|
!!!parse-error (type => 'not closed:table'); |
|
|
|
|
|
## As if </table> |
|
|
## have a table element in table scope |
|
|
my $i; |
|
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
my $node = $self->{open_elements}->[$_]; |
|
|
if ($node->[1] eq 'table') { |
|
|
$i = $_; |
|
|
last INSCOPE; |
|
|
} elsif ({ |
|
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
unless (defined $i) { |
|
|
!!!parse-error (type => 'unmatched end tag:table'); |
|
|
## Ignore tokens </table><table> |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
|
|
|
## generate implied end tags |
|
|
if ({ |
|
|
dd => 1, dt => 1, li => 1, p => 1, |
|
|
td => 1, th => 1, tr => 1, |
|
|
tbody => 1, tfoot=> 1, thead => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
!!!back-token; # <table> |
|
|
$token = {type => 'end tag', tag_name => 'table'}; |
|
|
!!!back-token; |
|
|
$token = {type => 'end tag', |
|
|
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
|
|
redo B; |
|
|
} |
|
|
|
|
|
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
} |
|
|
|
|
|
splice @{$self->{open_elements}}, $i; |
|
|
|
|
|
$self->_reset_insertion_mode; |
|
|
|
|
|
## reprocess |
|
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} elsif ($token->{type} eq 'end tag') { |
|
|
if ($token->{tag_name} eq 'tr') { |
|
|
## have an element in table scope |
|
|
my $i; |
|
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
my $node = $self->{open_elements}->[$_]; |
|
|
if ($node->[1] eq $token->{tag_name}) { |
|
|
$i = $_; |
|
|
last INSCOPE; |
|
|
} elsif ({ |
|
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
unless (defined $i) { |
|
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
|
|
|
## Clear back to table row context |
|
|
while (not { |
|
|
tr => 1, html => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
pop @{$self->{open_elements}}; |
|
|
} |
|
|
|
|
|
pop @{$self->{open_elements}}; # tr |
|
|
$self->{insertion_mode} = 'in table body'; |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'table') { |
|
|
## As if </tr> |
|
|
## have an element in table scope |
|
|
my $i; |
|
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
my $node = $self->{open_elements}->[$_]; |
|
|
if ($node->[1] eq 'tr') { |
|
|
$i = $_; |
|
|
last INSCOPE; |
|
|
} elsif ({ |
|
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
unless (defined $i) { |
|
|
!!!parse-error (type => 'unmatched end tag:'.$token->{type}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
|
|
|
## Clear back to table row context |
|
|
while (not { |
|
|
tr => 1, html => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
pop @{$self->{open_elements}}; |
|
|
} |
|
|
|
|
|
pop @{$self->{open_elements}}; # tr |
|
|
$self->{insertion_mode} = 'in table body'; |
|
|
## reprocess |
|
|
redo B; |
|
|
} elsif ({ |
|
|
tbody => 1, tfoot => 1, thead => 1, |
|
|
}->{$token->{tag_name}}) { |
|
|
## have an element in table scope |
|
|
my $i; |
|
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
my $node = $self->{open_elements}->[$_]; |
|
|
if ($node->[1] eq $token->{tag_name}) { |
|
|
$i = $_; |
|
|
last INSCOPE; |
|
|
} elsif ({ |
|
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
unless (defined $i) { |
|
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
|
|
|
## As if </tr> |
|
|
## have an element in table scope |
|
|
my $i; |
|
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
my $node = $self->{open_elements}->[$_]; |
|
|
if ($node->[1] eq 'tr') { |
|
|
$i = $_; |
|
|
last INSCOPE; |
|
|
} elsif ({ |
|
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
unless (defined $i) { |
|
|
!!!parse-error (type => 'unmatched end tag:tr'); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
|
|
|
## Clear back to table row context |
|
|
while (not { |
|
|
tr => 1, html => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
pop @{$self->{open_elements}}; |
|
|
} |
|
|
|
|
|
pop @{$self->{open_elements}}; # tr |
|
|
$self->{insertion_mode} = 'in table body'; |
|
|
## reprocess |
|
|
redo B; |
|
|
} elsif ({ |
|
|
body => 1, caption => 1, col => 1, |
|
|
colgroup => 1, html => 1, td => 1, th => 1, |
|
|
}->{$token->{tag_name}}) { |
|
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} else { |
|
|
# |
|
|
} |
|
|
|
|
|
## As if in table |
|
|
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
|
|
$in_body->($insert_to_foster); |
|
|
redo B; |
|
4591 |
} elsif ($self->{insertion_mode} eq 'in select') { |
} elsif ($self->{insertion_mode} eq 'in select') { |
4592 |
if ($token->{type} eq 'character') { |
if ($token->{type} eq 'character') { |
4593 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |