| 5575 |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
| 5576 |
menu => 1, ol => 1, p => 1, ul => 1, |
menu => 1, ol => 1, p => 1, ul => 1, |
| 5577 |
pre => 1, listing => 1, |
pre => 1, listing => 1, |
| 5578 |
|
form => 1, |
| 5579 |
|
table => 1, |
| 5580 |
|
hr => 1, |
| 5581 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5582 |
|
if ($token->{tag_name} eq 'form' and defined $self->{form_element}) { |
| 5583 |
|
!!!cp ('t350'); |
| 5584 |
|
!!!parse-error (type => 'in form:form'); |
| 5585 |
|
## Ignore the token |
| 5586 |
|
!!!next-token; |
| 5587 |
|
redo B; |
| 5588 |
|
} |
| 5589 |
|
|
| 5590 |
## has a p element in scope |
## has a p element in scope |
| 5591 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 5592 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
| 5617 |
} else { |
} else { |
| 5618 |
!!!cp ('t348'); |
!!!cp ('t348'); |
| 5619 |
} |
} |
| 5620 |
} else { |
} elsif ($token->{tag_name} eq 'form') { |
| 5621 |
!!!cp ('t347'); |
!!!cp ('t347.1'); |
| 5622 |
|
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
| 5623 |
|
|
| 5624 |
!!!next-token; |
!!!next-token; |
| 5625 |
} |
} elsif ($token->{tag_name} eq 'table') { |
| 5626 |
redo B; |
!!!cp ('t382'); |
| 5627 |
} elsif ($token->{tag_name} eq 'form') { |
push @{$open_tables}, [$self->{open_elements}->[-1]->[0]]; |
| 5628 |
if (defined $self->{form_element}) { |
|
| 5629 |
!!!cp ('t350'); |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5630 |
!!!parse-error (type => 'in form:form'); |
|
| 5631 |
## Ignore the token |
!!!next-token; |
| 5632 |
|
} elsif ($token->{tag_name} eq 'hr') { |
| 5633 |
|
!!!cp ('t386'); |
| 5634 |
|
pop @{$self->{open_elements}}; |
| 5635 |
|
|
| 5636 |
!!!next-token; |
!!!next-token; |
|
redo B; |
|
| 5637 |
} else { |
} else { |
| 5638 |
## has a p element in scope |
!!!cp ('t347'); |
|
INSCOPE: for (reverse @{$self->{open_elements}}) { |
|
|
if ($_->[1] eq 'p') { |
|
|
!!!cp ('t351'); |
|
|
!!!back-token; |
|
|
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
|
!!!cp ('t352'); |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
|
| 5639 |
!!!next-token; |
!!!next-token; |
|
redo B; |
|
| 5640 |
} |
} |
| 5641 |
} elsif ($token->{tag_name} eq 'li') { |
redo B; |
| 5642 |
|
} elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) { |
| 5643 |
## has a p element in scope |
## has a p element in scope |
| 5644 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 5645 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
| 5659 |
## Step 1 |
## Step 1 |
| 5660 |
my $i = -1; |
my $i = -1; |
| 5661 |
my $node = $self->{open_elements}->[$i]; |
my $node = $self->{open_elements}->[$i]; |
| 5662 |
|
my $li_or_dtdd = {li => {li => 1}, |
| 5663 |
|
dt => {dt => 1, dd => 1}, |
| 5664 |
|
dd => {dt => 1, dd => 1}}->{$token->{tag_name}}; |
| 5665 |
LI: { |
LI: { |
| 5666 |
## Step 2 |
## Step 2 |
| 5667 |
if ($node->[1] eq 'li') { |
if ($li_or_dtdd->{$node->[1]}) { |
| 5668 |
if ($i != -1) { |
if ($i != -1) { |
| 5669 |
!!!cp ('t355'); |
!!!cp ('t355'); |
| 5670 |
!!!parse-error (type => 'end tag missing:'. |
!!!parse-error (type => 'end tag missing:'. |
| 5698 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
| 5699 |
!!!next-token; |
!!!next-token; |
| 5700 |
redo B; |
redo B; |
|
} elsif ($token->{tag_name} eq 'dd' or $token->{tag_name} eq 'dt') { |
|
|
## has a p element in scope |
|
|
INSCOPE: for (reverse @{$self->{open_elements}}) { |
|
|
if ($_->[1] eq 'p') { |
|
|
!!!cp ('t360'); |
|
|
!!!back-token; |
|
|
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
|
!!!cp ('t361'); |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
|
|
|
## Step 1 |
|
|
my $i = -1; |
|
|
my $node = $self->{open_elements}->[$i]; |
|
|
LI: { |
|
|
## Step 2 |
|
|
if ($node->[1] eq 'dt' or $node->[1] eq 'dd') { |
|
|
if ($i != -1) { |
|
|
!!!cp ('t362'); |
|
|
!!!parse-error (type => 'end tag missing:'. |
|
|
$self->{open_elements}->[-1]->[1]); |
|
|
} else { |
|
|
!!!cp ('t363'); |
|
|
} |
|
|
splice @{$self->{open_elements}}, $i; |
|
|
last LI; |
|
|
} else { |
|
|
!!!cp ('t364'); |
|
|
} |
|
|
|
|
|
## Step 3 |
|
|
if (not $formatting_category->{$node->[1]} and |
|
|
#not $phrasing_category->{$node->[1]} and |
|
|
($special_category->{$node->[1]} or |
|
|
$scoping_category->{$node->[1]}) and |
|
|
$node->[1] ne 'address' and $node->[1] ne 'div') { |
|
|
!!!cp ('t365'); |
|
|
last LI; |
|
|
} |
|
|
|
|
|
!!!cp ('t366'); |
|
|
## Step 4 |
|
|
$i--; |
|
|
$node = $self->{open_elements}->[$i]; |
|
|
redo LI; |
|
|
} # LI |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 5701 |
} elsif ($token->{tag_name} eq 'plaintext') { |
} elsif ($token->{tag_name} eq 'plaintext') { |
| 5702 |
## has a p element in scope |
## has a p element in scope |
| 5703 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 5760 |
|
|
| 5761 |
!!!next-token; |
!!!next-token; |
| 5762 |
redo B; |
redo B; |
|
} elsif ({ |
|
|
b => 1, big => 1, em => 1, font => 1, i => 1, |
|
|
s => 1, small => 1, strile => 1, |
|
|
strong => 1, tt => 1, u => 1, |
|
|
}->{$token->{tag_name}}) { |
|
|
!!!cp ('t375'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
| 5763 |
} elsif ($token->{tag_name} eq 'nobr') { |
} elsif ($token->{tag_name} eq 'nobr') { |
| 5764 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 5765 |
|
|
| 5816 |
!!!next-token; |
!!!next-token; |
| 5817 |
redo B; |
redo B; |
| 5818 |
} elsif ({ |
} elsif ({ |
| 5819 |
applet => 1, marquee => 1, object => 1, |
xmp => 1, |
| 5820 |
|
iframe => 1, |
| 5821 |
|
noembed => 1, |
| 5822 |
|
noframes => 1, |
| 5823 |
|
noscript => 0, ## TODO: 1 if scripting is enabled |
| 5824 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5825 |
!!!cp ('t380'); |
if ($token->{tag_name} eq 'xmp') { |
| 5826 |
$reconstruct_active_formatting_elements->($insert_to_current); |
!!!cp ('t381'); |
| 5827 |
|
$reconstruct_active_formatting_elements->($insert_to_current); |
| 5828 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
} else { |
| 5829 |
push @$active_formatting_elements, ['#marker', '']; |
!!!cp ('t399'); |
| 5830 |
|
} |
| 5831 |
!!!next-token; |
## NOTE: There is an "as if in body" code clone. |
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'xmp') { |
|
|
!!!cp ('t381'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
| 5832 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 5833 |
redo B; |
redo B; |
|
} elsif ($token->{tag_name} eq 'table') { |
|
|
## has a p element in scope |
|
|
INSCOPE: for (reverse @{$self->{open_elements}}) { |
|
|
if ($_->[1] eq 'p') { |
|
|
!!!cp ('t382'); |
|
|
!!!back-token; |
|
|
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
|
|
redo B; |
|
|
} elsif ({ |
|
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
|
!!!cp ('t383'); |
|
|
last INSCOPE; |
|
|
} |
|
|
} # INSCOPE |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
push @{$open_tables}, [$self->{open_elements}->[-1]->[0]]; |
|
|
|
|
|
$self->{insertion_mode} = IN_TABLE_IM; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
| 5834 |
} elsif ({ |
} elsif ({ |
| 5835 |
|
b => 1, big => 1, em => 1, font => 1, i => 1, |
| 5836 |
|
s => 1, small => 1, strile => 1, |
| 5837 |
|
strong => 1, tt => 1, u => 1, |
| 5838 |
|
applet => 1, marquee => 1, object => 1, |
| 5839 |
area => 1, basefont => 1, bgsound => 1, br => 1, |
area => 1, basefont => 1, bgsound => 1, br => 1, |
| 5840 |
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
| 5841 |
image => 1, |
image => 1, |
| 5842 |
|
input => 1, |
| 5843 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5844 |
if ($token->{tag_name} eq 'image') { |
if ($token->{tag_name} eq 'image') { |
| 5845 |
!!!cp ('t384'); |
!!!cp ('t384'); |
| 5853 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 5854 |
|
|
| 5855 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
| 5856 |
pop @{$self->{open_elements}}; |
if ({ |
| 5857 |
|
applet => 1, marquee => 1, object => 1, |
| 5858 |
!!!next-token; |
}->{$token->{tag_name}}) { |
| 5859 |
redo B; |
!!!cp ('t380'); |
| 5860 |
} elsif ($token->{tag_name} eq 'hr') { |
push @$active_formatting_elements, ['#marker', '']; |
| 5861 |
## has a p element in scope |
} elsif ({ |
| 5862 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
b => 1, big => 1, em => 1, font => 1, i => 1, |
| 5863 |
if ($_->[1] eq 'p') { |
s => 1, small => 1, strile => 1, |
| 5864 |
!!!cp ('t386'); |
strong => 1, tt => 1, u => 1, |
| 5865 |
!!!back-token; |
}->{$token->{tag_name}}) { |
| 5866 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
!!!cp ('t375'); |
| 5867 |
redo B; |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
| 5868 |
} elsif ({ |
} elsif ($token->{tag_name} eq 'input') { |
| 5869 |
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
!!!cp ('t388'); |
| 5870 |
button => 1, marquee => 1, object => 1, html => 1, |
## TODO: associate with $self->{form_element} if defined |
| 5871 |
}->{$_->[1]}) { |
pop @{$self->{open_elements}}; |
| 5872 |
!!!cp ('t387'); |
} else { |
| 5873 |
last INSCOPE; |
!!!cp ('t388.1'); |
| 5874 |
} |
pop @{$self->{open_elements}}; |
| 5875 |
} # INSCOPE |
} |
| 5876 |
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
pop @{$self->{open_elements}}; |
|
|
|
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'input') { |
|
|
!!!cp ('t388'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
## TODO: associate with $self->{form_element} if defined |
|
|
pop @{$self->{open_elements}}; |
|
|
|
|
| 5877 |
!!!next-token; |
!!!next-token; |
| 5878 |
redo B; |
redo B; |
| 5879 |
} elsif ($token->{tag_name} eq 'isindex') { |
} elsif ($token->{tag_name} eq 'isindex') { |
| 5966 |
!!!next-token; |
!!!next-token; |
| 5967 |
redo B; |
redo B; |
| 5968 |
} elsif ({ |
} elsif ({ |
|
iframe => 1, |
|
|
noembed => 1, |
|
|
noframes => 1, |
|
|
noscript => 0, ## TODO: 1 if scripting is enabled |
|
|
}->{$token->{tag_name}}) { |
|
|
!!!cp ('t399'); |
|
|
## NOTE: There is an "as if in body" code clone. |
|
|
$parse_rcdata->(CDATA_CONTENT_MODEL); |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'select') { |
|
|
!!!cp ('t400'); |
|
|
$reconstruct_active_formatting_elements->($insert_to_current); |
|
|
|
|
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
|
|
|
|
|
## TODO: associate with $self->{form_element} if defined |
|
|
|
|
|
if ($self->{insertion_mode} & TABLE_IMS or |
|
|
$self->{insertion_mode} & BODY_TABLE_IMS or |
|
|
$self->{insertion_mode} == IN_COLUMN_GROUP_IM) { |
|
|
!!!cp ('t400.1'); |
|
|
$self->{insertion_mode} = IN_SELECT_IN_TABLE_IM; |
|
|
} else { |
|
|
!!!cp ('t400.2'); |
|
|
$self->{insertion_mode} = IN_SELECT_IM; |
|
|
} |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ({ |
|
| 5969 |
caption => 1, col => 1, colgroup => 1, frame => 1, |
caption => 1, col => 1, colgroup => 1, frame => 1, |
| 5970 |
frameset => 1, head => 1, option => 1, optgroup => 1, |
frameset => 1, head => 1, option => 1, optgroup => 1, |
| 5971 |
tbody => 1, td => 1, tfoot => 1, th => 1, |
tbody => 1, td => 1, tfoot => 1, th => 1, |
| 5983 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 5984 |
|
|
| 5985 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
| 5986 |
|
|
| 5987 |
|
if ($token->{tag_name} eq 'select') { |
| 5988 |
|
## TODO: associate with $self->{form_element} if defined |
| 5989 |
|
|
| 5990 |
|
if ($self->{insertion_mode} & TABLE_IMS or |
| 5991 |
|
$self->{insertion_mode} & BODY_TABLE_IMS or |
| 5992 |
|
$self->{insertion_mode} == IN_COLUMN_GROUP_IM) { |
| 5993 |
|
!!!cp ('t400.1'); |
| 5994 |
|
$self->{insertion_mode} = IN_SELECT_IN_TABLE_IM; |
| 5995 |
|
} else { |
| 5996 |
|
!!!cp ('t400.2'); |
| 5997 |
|
$self->{insertion_mode} = IN_SELECT_IM; |
| 5998 |
|
} |
| 5999 |
|
} |
| 6000 |
|
|
| 6001 |
!!!next-token; |
!!!next-token; |
| 6002 |
redo B; |
redo B; |