3336 |
$insert = $insert_to_current; |
$insert = $insert_to_current; |
3337 |
# |
# |
3338 |
} elsif ($self->{insertion_mode} & TABLE_IMS) { |
} elsif ($self->{insertion_mode} & TABLE_IMS) { |
3339 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
|
## NOTE: There are "character in table" code clones. |
|
3340 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
3341 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
3342 |
|
|
3393 |
|
|
3394 |
!!!next-token; |
!!!next-token; |
3395 |
redo B; |
redo B; |
3396 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
3397 |
if ({ |
if ({ |
3398 |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
3399 |
th => 1, td => 1, |
th => 1, td => 1, |
3579 |
die "$0: in table: <>: $token->{tag_name}"; |
die "$0: in table: <>: $token->{tag_name}"; |
3580 |
} |
} |
3581 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
|
## NOTE: There are code clones for this "table in table" |
|
3582 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3583 |
|
|
3584 |
## As if </table> |
## As if </table> |
3626 |
|
|
3627 |
## reprocess |
## reprocess |
3628 |
redo B; |
redo B; |
3629 |
} else { |
} else { |
3630 |
# |
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
3631 |
} |
|
3632 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
$insert = $insert_to_foster; |
3633 |
|
# |
3634 |
|
} |
3635 |
|
} elsif ($token->{type} == END_TAG_TOKEN) { |
3636 |
if ($token->{tag_name} eq 'tr' and |
if ($token->{tag_name} eq 'tr' and |
3637 |
$self->{insertion_mode} == IN_ROW_IM) { |
$self->{insertion_mode} == IN_ROW_IM) { |
3638 |
## have an element in table scope |
## have an element in table scope |
3889 |
## Ignore the token |
## Ignore the token |
3890 |
!!!next-token; |
!!!next-token; |
3891 |
redo B; |
redo B; |
3892 |
} else { |
} else { |
3893 |
# |
!!!parse-error (type => 'in table:/'.$token->{tag_name}); |
|
} |
|
|
} else { |
|
|
die "$0: $token->{type}: Unknown token type"; |
|
|
} |
|
|
|
|
|
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
|
3894 |
|
|
3895 |
$insert = $insert_to_foster; |
$insert = $insert_to_foster; |
3896 |
# |
# |
3897 |
|
} |
3898 |
|
} else { |
3899 |
|
die "$0: $token->{type}: Unknown token type"; |
3900 |
|
} |
3901 |
} elsif ($self->{insertion_mode} == IN_COLUMN_GROUP_IM) { |
} elsif ($self->{insertion_mode} == IN_COLUMN_GROUP_IM) { |
3902 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
3903 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
3956 |
redo B; |
redo B; |
3957 |
} |
} |
3958 |
} elsif ($self->{insertion_mode} == IN_SELECT_IM) { |
} elsif ($self->{insertion_mode} == IN_SELECT_IM) { |
3959 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
3960 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
3961 |
!!!next-token; |
!!!next-token; |
3962 |
redo B; |
redo B; |
3963 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
3964 |
if ($token->{tag_name} eq 'option') { |
if ($token->{tag_name} eq 'option') { |
3965 |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
3966 |
## As if </option> |
## As if </option> |
4013 |
|
|
4014 |
!!!next-token; |
!!!next-token; |
4015 |
redo B; |
redo B; |
4016 |
} else { |
} else { |
4017 |
# |
!!!parse-error (type => 'in select:'.$token->{tag_name}); |
4018 |
} |
## Ignore the token |
4019 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
!!!next-token; |
4020 |
|
redo B; |
4021 |
|
} |
4022 |
|
} elsif ($token->{type} == END_TAG_TOKEN) { |
4023 |
if ($token->{tag_name} eq 'optgroup') { |
if ($token->{tag_name} eq 'optgroup') { |
4024 |
if ($self->{open_elements}->[-1]->[1] eq 'option' and |
if ($self->{open_elements}->[-1]->[1] eq 'option' and |
4025 |
$self->{open_elements}->[-2]->[1] eq 'optgroup') { |
$self->{open_elements}->[-2]->[1] eq 'optgroup') { |
4121 |
|
|
4122 |
## reprocess |
## reprocess |
4123 |
redo B; |
redo B; |
4124 |
} else { |
} else { |
4125 |
# |
!!!parse-error (type => 'in select:/'.$token->{tag_name}); |
|
} |
|
|
} else { |
|
|
# |
|
|
} |
|
|
|
|
|
!!!parse-error (type => 'in select:'.$token->{tag_name}); |
|
4126 |
## Ignore the token |
## Ignore the token |
4127 |
!!!next-token; |
!!!next-token; |
4128 |
redo B; |
redo B; |
4129 |
|
} |
4130 |
|
} else { |
4131 |
|
die "$0: $token->{type}: Unknown token type"; |
4132 |
|
} |
4133 |
} elsif ($self->{insertion_mode} & BODY_AFTER_IMS) { |
} elsif ($self->{insertion_mode} & BODY_AFTER_IMS) { |
4134 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
4135 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
4660 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4661 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4662 |
if ($node->[1] eq 'nobr') { |
if ($node->[1] eq 'nobr') { |
4663 |
!!!parse-error (type => 'not closed:nobr'); |
!!!parse-error (type => 'in nobr:nobr'); |
4664 |
!!!back-token; |
!!!back-token; |
4665 |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr'}; |
4666 |
redo B; |
redo B; |
4865 |
noframes => 1, |
noframes => 1, |
4866 |
noscript => 0, ## TODO: 1 if scripting is enabled |
noscript => 0, ## TODO: 1 if scripting is enabled |
4867 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4868 |
## NOTE: There are two "as if in body" code clones. |
## NOTE: There is an "as if in body" code clone. |
4869 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
4870 |
redo B; |
redo B; |
4871 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
5021 |
if ($self->{open_elements}->[-1]->[1] eq $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[1] eq $token->{tag_name}) { |
5022 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5023 |
} else { |
} else { |
5024 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
5025 |
} |
} |
5026 |
|
|
5027 |
undef $self->{form_element}; |
undef $self->{form_element}; |
5059 |
} # INSCOPE |
} # INSCOPE |
5060 |
|
|
5061 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
5062 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
5063 |
} |
} |
5064 |
|
|
5065 |
splice @{$self->{open_elements}}, $i if defined $i; |
splice @{$self->{open_elements}}, $i if defined $i; |
5128 |
|
|
5129 |
## Step 2 |
## Step 2 |
5130 |
if ($token->{tag_name} ne $self->{open_elements}->[-1]->[1]) { |
if ($token->{tag_name} ne $self->{open_elements}->[-1]->[1]) { |
5131 |
|
## NOTE: <x><y></x> |
5132 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
5133 |
} |
} |
5134 |
|
|