3646 |
redo B; |
redo B; |
3647 |
|
|
3648 |
## ISSUE: An issue in the spec. |
## ISSUE: An issue in the spec. |
3649 |
} elsif ($self->{insertion_mode} eq 'in body') { |
} elsif ($self->{insertion_mode} eq 'in body' or |
3650 |
|
$self->{insertion_mode} eq 'in caption') { |
3651 |
if ($token->{type} eq 'character') { |
if ($token->{type} eq 'character') { |
3652 |
## NOTE: There is a code clone of "character in body". |
## NOTE: There is a code clone of "character in body". |
3653 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
3656 |
|
|
3657 |
!!!next-token; |
!!!next-token; |
3658 |
redo B; |
redo B; |
|
} else { |
|
|
$in_body->($insert_to_current); |
|
|
redo B; |
|
|
} |
|
|
} elsif ($self->{insertion_mode} eq 'in table') { |
|
|
if ($token->{type} eq 'character') { |
|
|
## NOTE: There are "character in table" code clones. |
|
|
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; |
|
3659 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
3660 |
if ({ |
if ({ |
3661 |
caption => 1, |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
3662 |
colgroup => 1, |
td => 1, tfoot => 1, th => 1, thead => 1, tr => 1, |
3663 |
tbody => 1, tfoot => 1, thead => 1, |
}->{$token->{tag_name}} and |
3664 |
}->{$token->{tag_name}}) { |
$self->{insertion_mode} eq 'in caption') { |
3665 |
## Clear back to table context |
!!!parse-error (type => 'not closed:caption'); |
|
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; |
|
|
} 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]); |
|
3666 |
|
|
3667 |
## As if </table> |
## As if </caption> |
3668 |
## have a table element in table scope |
## have a table element in table scope |
3669 |
my $i; |
my $i; |
3670 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
3671 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
3672 |
if ($node->[1] eq 'table') { |
if ($node->[1] eq 'caption') { |
3673 |
$i = $_; |
$i = $_; |
3674 |
last INSCOPE; |
last INSCOPE; |
3675 |
} elsif ({ |
} elsif ({ |
3679 |
} |
} |
3680 |
} # INSCOPE |
} # INSCOPE |
3681 |
unless (defined $i) { |
unless (defined $i) { |
3682 |
!!!parse-error (type => 'unmatched end tag:table'); |
!!!parse-error (type => 'unmatched end tag:caption'); |
3683 |
## Ignore tokens </table><table> |
## Ignore the token |
3684 |
!!!next-token; |
!!!next-token; |
3685 |
redo B; |
redo B; |
3686 |
} |
} |
3691 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
3692 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
3693 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
3694 |
!!!back-token; # <table> |
!!!back-token; # <?> |
3695 |
$token = {type => 'end tag', tag_name => 'table'}; |
$token = {type => 'end tag', tag_name => 'caption'}; |
3696 |
!!!back-token; |
!!!back-token; |
3697 |
$token = {type => 'end tag', |
$token = {type => 'end tag', |
3698 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
3699 |
redo B; |
redo B; |
3700 |
} |
} |
3701 |
|
|
3702 |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
3703 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3704 |
} |
} |
3705 |
|
|
3706 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
3707 |
|
|
3708 |
$self->_reset_insertion_mode; |
$clear_up_to_marker->(); |
3709 |
|
|
3710 |
|
$self->{insertion_mode} = 'in table'; |
3711 |
|
|
3712 |
## reprocess |
## reprocess |
3713 |
redo B; |
redo B; |
3715 |
# |
# |
3716 |
} |
} |
3717 |
} elsif ($token->{type} eq 'end tag') { |
} elsif ($token->{type} eq 'end tag') { |
3718 |
if ($token->{tag_name} eq 'table') { |
if ($token->{tag_name} eq 'caption' and |
3719 |
|
$self->{insertion_mode} eq 'in caption') { |
3720 |
## have a table element in table scope |
## have a table element in table scope |
3721 |
my $i; |
my $i; |
3722 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
3749 |
redo B; |
redo B; |
3750 |
} |
} |
3751 |
|
|
3752 |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
3753 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3754 |
} |
} |
3755 |
|
|
3756 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
3757 |
|
|
3758 |
$self->_reset_insertion_mode; |
$clear_up_to_marker->(); |
3759 |
|
|
3760 |
|
$self->{insertion_mode} = 'in table'; |
3761 |
|
|
3762 |
!!!next-token; |
!!!next-token; |
3763 |
redo B; |
redo B; |
3764 |
} elsif ({ |
} elsif ($token->{tag_name} eq 'table' and |
3765 |
body => 1, caption => 1, col => 1, colgroup => 1, |
$self->{insertion_mode} eq 'in caption') { |
|
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 caption') { |
|
|
if ($token->{type} eq 'character') { |
|
|
## NOTE: This is a code clone of "character in body". |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{type} eq 'start tag') { |
|
|
if ({ |
|
|
caption => 1, col => 1, colgroup => 1, tbody => 1, |
|
|
td => 1, tfoot => 1, th => 1, thead => 1, tr => 1, |
|
|
}->{$token->{tag_name}}) { |
|
3766 |
!!!parse-error (type => 'not closed:caption'); |
!!!parse-error (type => 'not closed:caption'); |
3767 |
|
|
3768 |
## As if </caption> |
## As if </caption> |
3792 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
3793 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
3794 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
3795 |
!!!back-token; # <?> |
!!!back-token; # </table> |
3796 |
$token = {type => 'end tag', tag_name => 'caption'}; |
$token = {type => 'end tag', tag_name => 'caption'}; |
3797 |
!!!back-token; |
!!!back-token; |
3798 |
$token = {type => 'end tag', |
$token = {type => 'end tag', |
3812 |
|
|
3813 |
## reprocess |
## reprocess |
3814 |
redo B; |
redo B; |
3815 |
|
} elsif ({ |
3816 |
|
body => 1, col => 1, colgroup => 1, |
3817 |
|
html => 1, tbody => 1, td => 1, tfoot => 1, |
3818 |
|
th => 1, thead => 1, tr => 1, |
3819 |
|
}->{$token->{tag_name}} and |
3820 |
|
$self->{insertion_mode} eq 'in caption') { |
3821 |
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3822 |
|
## Ignore the token |
3823 |
|
!!!next-token; |
3824 |
|
redo B; |
3825 |
} else { |
} else { |
3826 |
# |
# |
3827 |
} |
} |
3828 |
} elsif ($token->{type} eq 'end tag') { |
} else { |
3829 |
if ($token->{tag_name} eq 'caption') { |
# |
3830 |
|
} |
3831 |
|
|
3832 |
|
$in_body->($insert_to_current); |
3833 |
|
redo B; |
3834 |
|
} elsif ($self->{insertion_mode} eq 'in table') { |
3835 |
|
if ($token->{type} eq 'character') { |
3836 |
|
## NOTE: There are "character in table" code clones. |
3837 |
|
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
3838 |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
3839 |
|
|
3840 |
|
unless (length $token->{data}) { |
3841 |
|
!!!next-token; |
3842 |
|
redo B; |
3843 |
|
} |
3844 |
|
} |
3845 |
|
|
3846 |
|
!!!parse-error (type => 'in table:#character'); |
3847 |
|
|
3848 |
|
## As if in body, but insert into foster parent element |
3849 |
|
## ISSUE: Spec says that "whenever a node would be inserted |
3850 |
|
## into the current node" while characters might not be |
3851 |
|
## result in a new Text node. |
3852 |
|
$reconstruct_active_formatting_elements->($insert_to_foster); |
3853 |
|
|
3854 |
|
if ({ |
3855 |
|
table => 1, tbody => 1, tfoot => 1, |
3856 |
|
thead => 1, tr => 1, |
3857 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
3858 |
|
# MUST |
3859 |
|
my $foster_parent_element; |
3860 |
|
my $next_sibling; |
3861 |
|
my $prev_sibling; |
3862 |
|
OE: for (reverse 0..$#{$self->{open_elements}}) { |
3863 |
|
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
3864 |
|
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
3865 |
|
if (defined $parent and $parent->node_type == 1) { |
3866 |
|
$foster_parent_element = $parent; |
3867 |
|
$next_sibling = $self->{open_elements}->[$_]->[0]; |
3868 |
|
$prev_sibling = $next_sibling->previous_sibling; |
3869 |
|
} else { |
3870 |
|
$foster_parent_element = $self->{open_elements}->[$_ - 1]->[0]; |
3871 |
|
$prev_sibling = $foster_parent_element->last_child; |
3872 |
|
} |
3873 |
|
last OE; |
3874 |
|
} |
3875 |
|
} # OE |
3876 |
|
$foster_parent_element = $self->{open_elements}->[0]->[0] and |
3877 |
|
$prev_sibling = $foster_parent_element->last_child |
3878 |
|
unless defined $foster_parent_element; |
3879 |
|
if (defined $prev_sibling and |
3880 |
|
$prev_sibling->node_type == 3) { |
3881 |
|
$prev_sibling->manakai_append_text ($token->{data}); |
3882 |
|
} else { |
3883 |
|
$foster_parent_element->insert_before |
3884 |
|
($self->{document}->create_text_node ($token->{data}), |
3885 |
|
$next_sibling); |
3886 |
|
} |
3887 |
|
} else { |
3888 |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
3889 |
|
} |
3890 |
|
|
3891 |
|
!!!next-token; |
3892 |
|
redo B; |
3893 |
|
} elsif ($token->{type} eq 'start tag') { |
3894 |
|
if ({ |
3895 |
|
caption => 1, |
3896 |
|
colgroup => 1, |
3897 |
|
tbody => 1, tfoot => 1, thead => 1, |
3898 |
|
}->{$token->{tag_name}}) { |
3899 |
|
## Clear back to table context |
3900 |
|
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
3901 |
|
$self->{open_elements}->[-1]->[1] ne 'html') { |
3902 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3903 |
|
pop @{$self->{open_elements}}; |
3904 |
|
} |
3905 |
|
|
3906 |
|
push @$active_formatting_elements, ['#marker', ''] |
3907 |
|
if $token->{tag_name} eq 'caption'; |
3908 |
|
|
3909 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
3910 |
|
$self->{insertion_mode} = { |
3911 |
|
caption => 'in caption', |
3912 |
|
colgroup => 'in column group', |
3913 |
|
tbody => 'in table body', |
3914 |
|
tfoot => 'in table body', |
3915 |
|
thead => 'in table body', |
3916 |
|
}->{$token->{tag_name}}; |
3917 |
|
!!!next-token; |
3918 |
|
redo B; |
3919 |
|
} elsif ({ |
3920 |
|
col => 1, |
3921 |
|
td => 1, th => 1, tr => 1, |
3922 |
|
}->{$token->{tag_name}}) { |
3923 |
|
## Clear back to table context |
3924 |
|
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
3925 |
|
$self->{open_elements}->[-1]->[1] ne 'html') { |
3926 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3927 |
|
pop @{$self->{open_elements}}; |
3928 |
|
} |
3929 |
|
|
3930 |
|
!!!insert-element ($token->{tag_name} eq 'col' ? 'colgroup' : 'tbody'); |
3931 |
|
$self->{insertion_mode} = $token->{tag_name} eq 'col' |
3932 |
|
? 'in column group' : 'in table body'; |
3933 |
|
## reprocess |
3934 |
|
redo B; |
3935 |
|
} elsif ($token->{tag_name} eq 'table') { |
3936 |
|
## NOTE: There are code clones for this "table in table" |
3937 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3938 |
|
|
3939 |
|
## As if </table> |
3940 |
## have a table element in table scope |
## have a table element in table scope |
3941 |
my $i; |
my $i; |
3942 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
3943 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
3944 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq 'table') { |
3945 |
$i = $_; |
$i = $_; |
3946 |
last INSCOPE; |
last INSCOPE; |
3947 |
} elsif ({ |
} elsif ({ |
3951 |
} |
} |
3952 |
} # INSCOPE |
} # INSCOPE |
3953 |
unless (defined $i) { |
unless (defined $i) { |
3954 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:table'); |
3955 |
## Ignore the token |
## Ignore tokens </table><table> |
3956 |
!!!next-token; |
!!!next-token; |
3957 |
redo B; |
redo B; |
3958 |
} |
} |
3963 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
3964 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
3965 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
3966 |
|
!!!back-token; # <table> |
3967 |
|
$token = {type => 'end tag', tag_name => 'table'}; |
3968 |
!!!back-token; |
!!!back-token; |
3969 |
$token = {type => 'end tag', |
$token = {type => 'end tag', |
3970 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
3971 |
redo B; |
redo B; |
3972 |
} |
} |
3973 |
|
|
3974 |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
3975 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3976 |
} |
} |
3977 |
|
|
3978 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
3979 |
|
|
3980 |
$clear_up_to_marker->(); |
$self->_reset_insertion_mode; |
|
|
|
|
$self->{insertion_mode} = 'in table'; |
|
3981 |
|
|
3982 |
!!!next-token; |
## reprocess |
3983 |
redo B; |
redo B; |
3984 |
} elsif ($token->{tag_name} eq 'table') { |
} else { |
3985 |
!!!parse-error (type => 'not closed:caption'); |
# |
3986 |
|
} |
3987 |
## As if </caption> |
} elsif ($token->{type} eq 'end tag') { |
3988 |
|
if ($token->{tag_name} eq 'table') { |
3989 |
## have a table element in table scope |
## have a table element in table scope |
3990 |
my $i; |
my $i; |
3991 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
3992 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
3993 |
if ($node->[1] eq 'caption') { |
if ($node->[1] eq $token->{tag_name}) { |
3994 |
$i = $_; |
$i = $_; |
3995 |
last INSCOPE; |
last INSCOPE; |
3996 |
} elsif ({ |
} elsif ({ |
4000 |
} |
} |
4001 |
} # INSCOPE |
} # INSCOPE |
4002 |
unless (defined $i) { |
unless (defined $i) { |
4003 |
!!!parse-error (type => 'unmatched end tag:caption'); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4004 |
## Ignore the token |
## Ignore the token |
4005 |
!!!next-token; |
!!!next-token; |
4006 |
redo B; |
redo B; |
4012 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
4013 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
4014 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
|
!!!back-token; # </table> |
|
|
$token = {type => 'end tag', tag_name => 'caption'}; |
|
4015 |
!!!back-token; |
!!!back-token; |
4016 |
$token = {type => 'end tag', |
$token = {type => 'end tag', |
4017 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
4018 |
redo B; |
redo B; |
4019 |
} |
} |
4020 |
|
|
4021 |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
4022 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4023 |
} |
} |
4024 |
|
|
4025 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
4026 |
|
|
4027 |
$clear_up_to_marker->(); |
$self->_reset_insertion_mode; |
|
|
|
|
$self->{insertion_mode} = 'in table'; |
|
4028 |
|
|
4029 |
## reprocess |
!!!next-token; |
4030 |
redo B; |
redo B; |
4031 |
} elsif ({ |
} elsif ({ |
4032 |
body => 1, col => 1, colgroup => 1, |
body => 1, caption => 1, col => 1, colgroup => 1, |
4033 |
html => 1, tbody => 1, td => 1, tfoot => 1, |
html => 1, tbody => 1, td => 1, tfoot => 1, th => 1, |
4034 |
th => 1, thead => 1, tr => 1, |
thead => 1, tr => 1, |
4035 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4036 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4037 |
## Ignore the token |
## Ignore the token |
4043 |
} else { |
} else { |
4044 |
# |
# |
4045 |
} |
} |
4046 |
|
|
4047 |
$in_body->($insert_to_current); |
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
4048 |
|
$in_body->($insert_to_foster); |
4049 |
redo B; |
redo B; |
4050 |
} elsif ($self->{insertion_mode} eq 'in column group') { |
} elsif ($self->{insertion_mode} eq 'in column group') { |
4051 |
if ($token->{type} eq 'character') { |
if ($token->{type} eq 'character') { |