4090 |
redo B; |
redo B; |
4091 |
} elsif ({ |
} elsif ({ |
4092 |
caption => 1, col => 1, colgroup => 1, |
caption => 1, col => 1, colgroup => 1, |
4093 |
tbody => 1, tfoot => 1, thead => 1, tr => 1, |
tbody => 1, tfoot => 1, thead => 1, |
4094 |
}->{$token->{tag_name}} and |
tr => 1, # $self->{insertion_mode} eq 'in row' |
4095 |
$self->{insertion_mode} eq 'in row') { |
}->{$token->{tag_name}}) { |
4096 |
## As if </tr> |
if ($self->{insertion_mode} eq 'in row') { |
4097 |
## have an element in table scope |
## As if </tr> |
4098 |
my $i; |
## have an element in table scope |
4099 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
my $i; |
4100 |
my $node = $self->{open_elements}->[$_]; |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4101 |
if ($node->[1] eq 'tr') { |
my $node = $self->{open_elements}->[$_]; |
4102 |
$i = $_; |
if ($node->[1] eq 'tr') { |
4103 |
last INSCOPE; |
$i = $_; |
4104 |
} elsif ({ |
last INSCOPE; |
4105 |
table => 1, html => 1, |
} elsif ({ |
4106 |
}->{$node->[1]}) { |
table => 1, html => 1, |
4107 |
last INSCOPE; |
}->{$node->[1]}) { |
4108 |
|
last INSCOPE; |
4109 |
|
} |
4110 |
|
} # INSCOPE |
4111 |
|
unless (defined $i) { |
4112 |
|
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}); |
4113 |
|
## Ignore the token |
4114 |
|
!!!next-token; |
4115 |
|
redo B; |
4116 |
|
} |
4117 |
|
|
4118 |
|
## Clear back to table row context |
4119 |
|
while (not { |
4120 |
|
tr => 1, html => 1, |
4121 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4122 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4123 |
|
pop @{$self->{open_elements}}; |
4124 |
|
} |
4125 |
|
|
4126 |
|
pop @{$self->{open_elements}}; # tr |
4127 |
|
$self->{insertion_mode} = 'in table body'; |
4128 |
|
if ($token->{tag_name} eq 'tr') { |
4129 |
|
## reprocess |
4130 |
|
redo B; |
4131 |
|
} else { |
4132 |
|
## reprocess in the "in table body" insertion mode... |
4133 |
} |
} |
|
} # INSCOPE |
|
|
unless (defined $i) { |
|
|
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
4134 |
} |
} |
4135 |
|
|
4136 |
## Clear back to table row context |
if ($self->{insertion_mode} eq 'in table body') { |
4137 |
while (not { |
## have an element in table scope |
4138 |
tr => 1, html => 1, |
my $i; |
4139 |
}->{$self->{open_elements}->[-1]->[1]}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4140 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
my $node = $self->{open_elements}->[$_]; |
4141 |
|
if ({ |
4142 |
|
tbody => 1, thead => 1, tfoot => 1, |
4143 |
|
}->{$node->[1]}) { |
4144 |
|
$i = $_; |
4145 |
|
last INSCOPE; |
4146 |
|
} elsif ({ |
4147 |
|
table => 1, html => 1, |
4148 |
|
}->{$node->[1]}) { |
4149 |
|
last INSCOPE; |
4150 |
|
} |
4151 |
|
} # INSCOPE |
4152 |
|
unless (defined $i) { |
4153 |
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4154 |
|
## Ignore the token |
4155 |
|
!!!next-token; |
4156 |
|
redo B; |
4157 |
|
} |
4158 |
|
|
4159 |
|
## Clear back to table body context |
4160 |
|
while (not { |
4161 |
|
tbody => 1, tfoot => 1, thead => 1, html => 1, |
4162 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
4163 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4164 |
|
pop @{$self->{open_elements}}; |
4165 |
|
} |
4166 |
|
|
4167 |
|
## As if <{current node}> |
4168 |
|
## have an element in table scope |
4169 |
|
## true by definition |
4170 |
|
|
4171 |
|
## Clear back to table body context |
4172 |
|
## nop by definition |
4173 |
|
|
4174 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4175 |
|
$self->{insertion_mode} = 'in table'; |
4176 |
|
## reprocess in "in table" insertion mode... |
4177 |
} |
} |
4178 |
|
|
4179 |
pop @{$self->{open_elements}}; # tr |
if ($token->{tag_name} eq 'col') { |
4180 |
$self->{insertion_mode} = 'in table body'; |
## Clear back to table context |
4181 |
## reprocess |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
4182 |
redo B; |
$self->{open_elements}->[-1]->[1] ne 'html') { |
4183 |
} elsif ({ |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4184 |
caption => 1, col => 1, colgroup => 1, |
pop @{$self->{open_elements}}; |
|
tbody => 1, tfoot => 1, thead => 1, |
|
|
}->{$token->{tag_name}} and |
|
|
$self->{insertion_mode} eq 'in table body') { |
|
|
## have an element in table scope |
|
|
my $i; |
|
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
my $node = $self->{open_elements}->[$_]; |
|
|
if ({ |
|
|
tbody => 1, thead => 1, tfoot => 1, |
|
|
}->{$node->[1]}) { |
|
|
$i = $_; |
|
|
last INSCOPE; |
|
|
} elsif ({ |
|
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
|
last INSCOPE; |
|
4185 |
} |
} |
4186 |
} # INSCOPE |
|
4187 |
unless (defined $i) { |
!!!insert-element ('colgroup'); |
4188 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
$self->{insertion_mode} = 'in column group'; |
4189 |
## Ignore the token |
## reprocess |
4190 |
|
redo B; |
4191 |
|
} elsif ({ |
4192 |
|
caption => 1, |
4193 |
|
colgroup => 1, |
4194 |
|
tbody => 1, tfoot => 1, thead => 1, |
4195 |
|
}->{$token->{tag_name}}) { |
4196 |
|
## Clear back to table context |
4197 |
|
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
4198 |
|
$self->{open_elements}->[-1]->[1] ne 'html') { |
4199 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4200 |
|
pop @{$self->{open_elements}}; |
4201 |
|
} |
4202 |
|
|
4203 |
|
push @$active_formatting_elements, ['#marker', ''] |
4204 |
|
if $token->{tag_name} eq 'caption'; |
4205 |
|
|
4206 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4207 |
|
$self->{insertion_mode} = { |
4208 |
|
caption => 'in caption', |
4209 |
|
colgroup => 'in column group', |
4210 |
|
tbody => 'in table body', |
4211 |
|
tfoot => 'in table body', |
4212 |
|
thead => 'in table body', |
4213 |
|
}->{$token->{tag_name}}; |
4214 |
!!!next-token; |
!!!next-token; |
4215 |
redo B; |
redo B; |
4216 |
|
} else { |
4217 |
|
die "$0: in table: <>: $token->{tag_name}"; |
4218 |
} |
} |
|
|
|
|
## Clear back to table body context |
|
|
while (not { |
|
|
tbody => 1, tfoot => 1, thead => 1, html => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
|
|
pop @{$self->{open_elements}}; |
|
|
} |
|
|
|
|
|
## As if <{current node}> |
|
|
## have an element in table scope |
|
|
## true by definition |
|
|
|
|
|
## Clear back to table body context |
|
|
## nop by definition |
|
|
|
|
|
pop @{$self->{open_elements}}; |
|
|
$self->{insertion_mode} = 'in table'; |
|
|
## reprocess |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'col' and |
|
|
$self->{insertion_mode} eq 'in table') { |
|
|
## 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 ('colgroup'); |
|
|
$self->{insertion_mode} = 'in column group'; |
|
|
## reprocess |
|
|
redo B; |
|
|
} elsif ({ |
|
|
caption => 1, |
|
|
colgroup => 1, |
|
|
tbody => 1, tfoot => 1, thead => 1, |
|
|
}->{$token->{tag_name}} and |
|
|
$self->{insertion_mode} eq 'in table') { |
|
|
## 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}}; |
|
|
} |
|
|
|
|
|
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; |
|
4219 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
4220 |
## NOTE: There are code clones for this "table in table" |
## NOTE: There are code clones for this "table in table" |
4221 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4319 |
last INSCOPE; |
last INSCOPE; |
4320 |
} |
} |
4321 |
} # INSCOPE |
} # INSCOPE |
4322 |
unless (defined $i) { |
unless (defined $i) { |
4323 |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}); |
4324 |
## Ignore the token |
## Ignore the token |
4325 |
!!!next-token; |
!!!next-token; |
4326 |
redo B; |
redo B; |
4327 |
} |
} |
4328 |
|
|
4329 |
## Clear back to table row context |
## Clear back to table row context |
4330 |
while (not { |
while (not { |