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') { |
} elsif ($self->{insertion_mode} eq 'in table body' or |
3974 |
|
$self->{insertion_mode} eq 'in table') { |
3975 |
if ($token->{type} eq 'character') { |
if ($token->{type} eq 'character') { |
3976 |
## NOTE: There are "character in table" code clones. |
## NOTE: There are "character in table" code clones. |
3977 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
4032 |
redo B; |
redo B; |
4033 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
4034 |
if ({ |
if ({ |
4035 |
caption => 1, |
tr => 1, |
4036 |
colgroup => 1, |
th => 1, td => 1, |
|
tbody => 1, tfoot => 1, thead => 1, |
|
4037 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4038 |
## Clear back to table context |
if ($self->{insertion_mode} eq 'in table') { |
4039 |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
## Clear back to table context |
4040 |
$self->{open_elements}->[-1]->[1] ne 'html') { |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
4041 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
$self->{open_elements}->[-1]->[1] ne 'html') { |
4042 |
pop @{$self->{open_elements}}; |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4043 |
} |
pop @{$self->{open_elements}}; |
|
|
|
|
push @$active_formatting_elements, ['#marker', ''] |
|
|
if $token->{tag_name} eq 'caption'; |
|
|
|
|
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
|
|
$self->{insertion_mode} = { |
|
|
caption => 'in caption', |
|
|
colgroup => 'in column group', |
|
|
tbody => 'in table body', |
|
|
tfoot => 'in table body', |
|
|
thead => 'in table body', |
|
|
}->{$token->{tag_name}}; |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
col => 1, |
|
|
td => 1, th => 1, tr => 1, |
|
|
}->{$token->{tag_name}}) { |
|
|
## Clear back to table context |
|
|
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
|
|
$self->{open_elements}->[-1]->[1] ne 'html') { |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
pop @{$self->{open_elements}}; |
|
|
} |
|
|
|
|
|
!!!insert-element ($token->{tag_name} eq 'col' ? 'colgroup' : 'tbody'); |
|
|
$self->{insertion_mode} = $token->{tag_name} eq 'col' |
|
|
? 'in column group' : 'in table body'; |
|
|
## reprocess |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'table') { |
|
|
## NOTE: There are code clones for this "table in table" |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
|
|
|
## 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; |
|
4044 |
} |
} |
4045 |
} # INSCOPE |
|
4046 |
unless (defined $i) { |
!!!insert-element ('tbody'); |
4047 |
!!!parse-error (type => 'unmatched end tag:table'); |
$self->{insertion_mode} = 'in table body'; |
4048 |
## Ignore tokens </table><table> |
## reprocess in the "in table body" insertion mode... |
|
!!!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; |
|
4049 |
} |
} |
4050 |
|
|
|
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 '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 $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; |
|
|
} |
|
|
|
|
|
## 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; |
|
|
$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; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
body => 1, caption => 1, col => 1, colgroup => 1, |
|
|
html => 1, tbody => 1, td => 1, tfoot => 1, th => 1, |
|
|
thead => 1, tr => 1, |
|
|
}->{$token->{tag_name}}) { |
|
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} else { |
|
|
# |
|
|
} |
|
|
|
|
|
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
|
|
$in_body->($insert_to_foster); |
|
|
redo B; |
|
|
} elsif ($self->{insertion_mode} eq 'in column group') { |
|
|
if ($token->{type} eq 'character') { |
|
|
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; |
|
|
} |
|
|
} |
|
|
|
|
|
# |
|
|
} elsif ($token->{type} eq 'start tag') { |
|
|
if ($token->{tag_name} eq 'col') { |
|
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
|
|
pop @{$self->{open_elements}}; |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} elsif ($token->{type} eq 'end tag') { |
|
|
if ($token->{tag_name} eq 'colgroup') { |
|
|
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
|
|
!!!parse-error (type => 'unmatched end tag:colgroup'); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} else { |
|
|
pop @{$self->{open_elements}}; # colgroup |
|
|
$self->{insertion_mode} = 'in table'; |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
} elsif ($token->{tag_name} eq 'col') { |
|
|
!!!parse-error (type => 'unmatched end tag:col'); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} else { |
|
|
# |
|
|
} |
|
|
|
|
|
## As if </colgroup> |
|
|
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
|
|
!!!parse-error (type => 'unmatched end tag:colgroup'); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} else { |
|
|
pop @{$self->{open_elements}}; # colgroup |
|
|
$self->{insertion_mode} = 'in table'; |
|
|
## reprocess |
|
|
redo B; |
|
|
} |
|
|
} elsif ($self->{insertion_mode} eq 'in table body') { |
|
|
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 ({ |
|
|
tr => 1, |
|
|
th => 1, td => 1, |
|
|
}->{$token->{tag_name}}) { |
|
4051 |
unless ($token->{tag_name} eq 'tr') { |
unless ($token->{tag_name} eq 'tr') { |
4052 |
!!!parse-error (type => 'missing start tag:tr'); |
!!!parse-error (type => 'missing start tag:tr'); |
4053 |
} |
} |
4072 |
} elsif ({ |
} elsif ({ |
4073 |
caption => 1, col => 1, colgroup => 1, |
caption => 1, col => 1, colgroup => 1, |
4074 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
4075 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}} and |
4076 |
|
$self->{insertion_mode} eq 'in table body') { |
4077 |
## have an element in table scope |
## have an element in table scope |
4078 |
my $i; |
my $i; |
4079 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4115 |
$self->{insertion_mode} = 'in table'; |
$self->{insertion_mode} = 'in table'; |
4116 |
## reprocess |
## reprocess |
4117 |
redo B; |
redo B; |
4118 |
|
} elsif ($token->{tag_name} eq 'col' and |
4119 |
|
$self->{insertion_mode} eq 'in table') { |
4120 |
|
## Clear back to table context |
4121 |
|
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
4122 |
|
$self->{open_elements}->[-1]->[1] ne 'html') { |
4123 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4124 |
|
pop @{$self->{open_elements}}; |
4125 |
|
} |
4126 |
|
|
4127 |
|
!!!insert-element ('colgroup'); |
4128 |
|
$self->{insertion_mode} = 'in column group'; |
4129 |
|
## reprocess |
4130 |
|
redo B; |
4131 |
|
} elsif ({ |
4132 |
|
caption => 1, |
4133 |
|
colgroup => 1, |
4134 |
|
tbody => 1, tfoot => 1, thead => 1, |
4135 |
|
}->{$token->{tag_name}} and |
4136 |
|
$self->{insertion_mode} eq 'in table') { |
4137 |
|
## Clear back to table context |
4138 |
|
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
4139 |
|
$self->{open_elements}->[-1]->[1] ne 'html') { |
4140 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4141 |
|
pop @{$self->{open_elements}}; |
4142 |
|
} |
4143 |
|
|
4144 |
|
push @$active_formatting_elements, ['#marker', ''] |
4145 |
|
if $token->{tag_name} eq 'caption'; |
4146 |
|
|
4147 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4148 |
|
$self->{insertion_mode} = { |
4149 |
|
caption => 'in caption', |
4150 |
|
colgroup => 'in column group', |
4151 |
|
tbody => 'in table body', |
4152 |
|
tfoot => 'in table body', |
4153 |
|
thead => 'in table body', |
4154 |
|
}->{$token->{tag_name}}; |
4155 |
|
!!!next-token; |
4156 |
|
redo B; |
4157 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
4158 |
## NOTE: This is a code clone of "table in table" |
## NOTE: There are code clones for this "table in table" |
4159 |
!!!parse-error (type => 'not closed:table'); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4160 |
|
|
4161 |
## As if </table> |
## As if </table> |
4162 |
## have a table element in table scope |
## have a table element in table scope |
4199 |
|
|
4200 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
4201 |
|
|
4202 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
4203 |
|
|
4204 |
## reprocess |
## reprocess |
4205 |
redo B; |
redo B; |
4207 |
# |
# |
4208 |
} |
} |
4209 |
} elsif ($token->{type} eq 'end tag') { |
} elsif ($token->{type} eq 'end tag') { |
4210 |
if ({ |
if ($token->{tag_name} eq 'table') { |
4211 |
tbody => 1, tfoot => 1, thead => 1, |
if ($self->{insertion_mode} eq 'in table body') { |
4212 |
}->{$token->{tag_name}}) { |
## have an element in table scope |
4213 |
## have an element in table scope |
my $i; |
4214 |
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4215 |
|
my $node = $self->{open_elements}->[$_]; |
4216 |
|
if ({ |
4217 |
|
tbody => 1, thead => 1, tfoot => 1, |
4218 |
|
}->{$node->[1]}) { |
4219 |
|
$i = $_; |
4220 |
|
last INSCOPE; |
4221 |
|
} elsif ({ |
4222 |
|
table => 1, html => 1, |
4223 |
|
}->{$node->[1]}) { |
4224 |
|
last INSCOPE; |
4225 |
|
} |
4226 |
|
} # INSCOPE |
4227 |
|
unless (defined $i) { |
4228 |
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4229 |
|
## Ignore the token |
4230 |
|
!!!next-token; |
4231 |
|
redo B; |
4232 |
|
} |
4233 |
|
|
4234 |
|
## Clear back to table body context |
4235 |
|
while (not { |
4236 |
|
tbody => 1, tfoot => 1, thead => 1, html => 1, |
4237 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4238 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4239 |
|
pop @{$self->{open_elements}}; |
4240 |
|
} |
4241 |
|
|
4242 |
|
## As if <{current node}> |
4243 |
|
## have an element in table scope |
4244 |
|
## true by definition |
4245 |
|
|
4246 |
|
## Clear back to table body context |
4247 |
|
## nop by definition |
4248 |
|
|
4249 |
|
pop @{$self->{open_elements}}; |
4250 |
|
$self->{insertion_mode} = 'in table'; |
4251 |
|
## reprocess in the "in table" insertion mode... |
4252 |
|
} |
4253 |
|
|
4254 |
|
## have a table element in table scope |
4255 |
my $i; |
my $i; |
4256 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4257 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4271 |
redo B; |
redo B; |
4272 |
} |
} |
4273 |
|
|
4274 |
## Clear back to table body context |
## generate implied end tags |
4275 |
while (not { |
if ({ |
4276 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
dd => 1, dt => 1, li => 1, p => 1, |
4277 |
}->{$self->{open_elements}->[-1]->[1]}) { |
td => 1, th => 1, tr => 1, |
4278 |
|
tbody => 1, tfoot=> 1, thead => 1, |
4279 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4280 |
|
!!!back-token; |
4281 |
|
$token = {type => 'end tag', |
4282 |
|
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
4283 |
|
redo B; |
4284 |
|
} |
4285 |
|
|
4286 |
|
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
4287 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
pop @{$self->{open_elements}}; |
|
4288 |
} |
} |
4289 |
|
|
4290 |
pop @{$self->{open_elements}}; |
splice @{$self->{open_elements}}, $i; |
4291 |
$self->{insertion_mode} = 'in table'; |
|
4292 |
|
$self->_reset_insertion_mode; |
4293 |
|
|
4294 |
!!!next-token; |
!!!next-token; |
4295 |
redo B; |
redo B; |
4296 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ({ |
4297 |
|
tbody => 1, tfoot => 1, thead => 1, |
4298 |
|
}->{$token->{tag_name}} and |
4299 |
|
$self->{insertion_mode} eq 'in table body') { |
4300 |
## have an element in table scope |
## have an element in table scope |
4301 |
my $i; |
my $i; |
4302 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4303 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4304 |
if ({ |
if ($node->[1] eq $token->{tag_name}) { |
|
tbody => 1, thead => 1, tfoot => 1, |
|
|
}->{$node->[1]}) { |
|
4305 |
$i = $_; |
$i = $_; |
4306 |
last INSCOPE; |
last INSCOPE; |
4307 |
} elsif ({ |
} elsif ({ |
4325 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4326 |
} |
} |
4327 |
|
|
|
## As if <{current node}> |
|
|
## have an element in table scope |
|
|
## true by definition |
|
|
|
|
|
## Clear back to table body context |
|
|
## nop by definition |
|
|
|
|
4328 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4329 |
$self->{insertion_mode} = 'in table'; |
$self->{insertion_mode} = 'in table'; |
4330 |
## reprocess |
!!!next-token; |
4331 |
redo B; |
redo B; |
4332 |
} elsif ({ |
} elsif ({ |
4333 |
body => 1, caption => 1, col => 1, colgroup => 1, |
body => 1, caption => 1, col => 1, colgroup => 1, |
4334 |
html => 1, td => 1, th => 1, tr => 1, |
html => 1, td => 1, th => 1, tr => 1, |
4335 |
|
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} eq 'in table' |
4336 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4337 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4338 |
## Ignore the token |
## Ignore the token |
4342 |
# |
# |
4343 |
} |
} |
4344 |
} else { |
} else { |
4345 |
# |
die "$0: $token->{type}: Unknown token type"; |
4346 |
} |
} |
4347 |
|
|
|
## As if in table |
|
4348 |
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
4349 |
$in_body->($insert_to_foster); |
$in_body->($insert_to_foster); |
4350 |
redo B; |
redo B; |
4351 |
|
} elsif ($self->{insertion_mode} eq 'in column group') { |
4352 |
|
if ($token->{type} eq 'character') { |
4353 |
|
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
4354 |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
4355 |
|
unless (length $token->{data}) { |
4356 |
|
!!!next-token; |
4357 |
|
redo B; |
4358 |
|
} |
4359 |
|
} |
4360 |
|
|
4361 |
|
# |
4362 |
|
} elsif ($token->{type} eq 'start tag') { |
4363 |
|
if ($token->{tag_name} eq 'col') { |
4364 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4365 |
|
pop @{$self->{open_elements}}; |
4366 |
|
!!!next-token; |
4367 |
|
redo B; |
4368 |
|
} else { |
4369 |
|
# |
4370 |
|
} |
4371 |
|
} elsif ($token->{type} eq 'end tag') { |
4372 |
|
if ($token->{tag_name} eq 'colgroup') { |
4373 |
|
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
4374 |
|
!!!parse-error (type => 'unmatched end tag:colgroup'); |
4375 |
|
## Ignore the token |
4376 |
|
!!!next-token; |
4377 |
|
redo B; |
4378 |
|
} else { |
4379 |
|
pop @{$self->{open_elements}}; # colgroup |
4380 |
|
$self->{insertion_mode} = 'in table'; |
4381 |
|
!!!next-token; |
4382 |
|
redo B; |
4383 |
|
} |
4384 |
|
} elsif ($token->{tag_name} eq 'col') { |
4385 |
|
!!!parse-error (type => 'unmatched end tag:col'); |
4386 |
|
## Ignore the token |
4387 |
|
!!!next-token; |
4388 |
|
redo B; |
4389 |
|
} else { |
4390 |
|
# |
4391 |
|
} |
4392 |
|
} else { |
4393 |
|
# |
4394 |
|
} |
4395 |
|
|
4396 |
|
## As if </colgroup> |
4397 |
|
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
4398 |
|
!!!parse-error (type => 'unmatched end tag:colgroup'); |
4399 |
|
## Ignore the token |
4400 |
|
!!!next-token; |
4401 |
|
redo B; |
4402 |
|
} else { |
4403 |
|
pop @{$self->{open_elements}}; # colgroup |
4404 |
|
$self->{insertion_mode} = 'in table'; |
4405 |
|
## reprocess |
4406 |
|
redo B; |
4407 |
|
} |
4408 |
} elsif ($self->{insertion_mode} eq 'in row') { |
} elsif ($self->{insertion_mode} eq 'in row') { |
4409 |
if ($token->{type} eq 'character') { |
if ($token->{type} eq 'character') { |
4410 |
## NOTE: This is a "character in table" code clone. |
## NOTE: This is a "character in table" code clone. |