28 |
my $XML_NS = q<http://www.w3.org/XML/1998/namespace>; |
my $XML_NS = q<http://www.w3.org/XML/1998/namespace>; |
29 |
my $XMLNS_NS = q<http://www.w3.org/2000/xmlns/>; |
my $XMLNS_NS = q<http://www.w3.org/2000/xmlns/>; |
30 |
|
|
31 |
sub A_EL () { 0b1 } |
## Bits 12-15 |
32 |
sub ADDRESS_EL () { 0b10 } |
sub SPECIAL_EL () { 0b1_000000000000000 } |
33 |
sub BODY_EL () { 0b100 } |
sub SCOPING_EL () { 0b1_00000000000000 } |
34 |
sub BUTTON_EL () { 0b1000 } |
sub FORMATTING_EL () { 0b1_0000000000000 } |
35 |
sub CAPTION_EL () { 0b10000 } |
sub PHRASING_EL () { 0b1_000000000000 } |
36 |
sub DD_EL () { 0b100000 } |
|
37 |
sub DIV_EL () { 0b1000000 } |
## Bits 10-11 |
38 |
sub DT_EL () { 0b10000000 } |
sub FOREIGN_EL () { 0b1_00000000000 } |
39 |
sub FORM_EL () { 0b100000000 } |
sub FOREIGN_FLOW_CONTENT_EL () { 0b1_0000000000 } |
40 |
sub FORMATTING_EL () { 0b1000000000 } |
|
41 |
sub FRAMESET_EL () { 0b10000000000 } |
## Bits 6-9 |
42 |
sub HEADING_EL () { 0b100000000000 } |
sub TABLE_SCOPING_EL () { 0b1_000000000 } |
43 |
sub HTML_EL () { 0b1000000000000 } |
sub TABLE_ROWS_SCOPING_EL () { 0b1_00000000 } |
44 |
sub LI_EL () { 0b10000000000000 } |
sub TABLE_ROW_SCOPING_EL () { 0b1_0000000 } |
45 |
sub NOBR_EL () { 0b100000000000000 } |
sub TABLE_ROWS_EL () { 0b1_000000 } |
46 |
sub OPTION_EL () { 0b1000000000000000 } |
|
47 |
sub OPTGROUP_EL () { 0b10000000000000000 } |
## Bit 5 |
48 |
sub P_EL () { 0b100000000000000000 } |
sub ADDRESS_DIV_P_EL () { 0b1_00000 } |
49 |
sub SELECT_EL () { 0b1000000000000000000 } |
|
50 |
sub TABLE_EL () { 0b10000000000000000000 } |
## NOTE: Used in </body> and EOF algorithms. |
51 |
sub TABLE_CELL_EL () { 0b100000000000000000000 } |
## Bit 4 |
52 |
sub TABLE_ROW_EL () { 0b1000000000000000000000 } |
sub ALL_END_TAG_OPTIONAL_EL () { 0b1_0000 } |
|
sub TABLE_ROW_GROUP_EL () { 0b10000000000000000000000 } |
|
|
sub MISC_SCOPING_EL () { 0b100000000000000000000000 } |
|
|
sub MISC_SPECIAL_EL () { 0b1000000000000000000000000 } |
|
|
sub FOREIGN_EL () { 0b10000000000000000000000000 } |
|
|
sub FOREIGN_FLOW_CONTENT_EL () { 0b100000000000000000000000000 } |
|
|
sub MML_AXML_EL () { 0b1000000000000000000000000000 } |
|
|
sub RUBY_EL () { 0b10000000000000000000000000000 } |
|
|
sub RUBY_COMPONENT_EL () { 0b100000000000000000000000000000 } |
|
|
|
|
|
sub TABLE_ROWS_EL () { |
|
|
TABLE_EL | |
|
|
TABLE_ROW_EL | |
|
|
TABLE_ROW_GROUP_EL |
|
|
} |
|
53 |
|
|
54 |
## NOTE: Used in "generate implied end tags" algorithm. |
## NOTE: Used in "generate implied end tags" algorithm. |
55 |
## NOTE: There is a code where a modified version of |
## NOTE: There is a code where a modified version of |
56 |
## END_TAG_OPTIONAL_EL is used in "generate implied end tags" |
## END_TAG_OPTIONAL_EL is used in "generate implied end tags" |
57 |
## implementation (search for the algorithm name). |
## implementation (search for the algorithm name). |
58 |
sub END_TAG_OPTIONAL_EL () { |
## Bit 3 |
59 |
DD_EL | |
sub END_TAG_OPTIONAL_EL () { 0b1_000 } |
|
DT_EL | |
|
|
LI_EL | |
|
|
OPTION_EL | |
|
|
OPTGROUP_EL | |
|
|
P_EL | |
|
|
RUBY_COMPONENT_EL |
|
|
} |
|
60 |
|
|
61 |
## NOTE: Used in </body> and EOF algorithms. |
## Bits 0-2 |
|
sub ALL_END_TAG_OPTIONAL_EL () { |
|
|
DD_EL | |
|
|
DT_EL | |
|
|
LI_EL | |
|
|
P_EL | |
|
|
|
|
|
## ISSUE: option, optgroup, rt, rp? |
|
|
|
|
|
BODY_EL | |
|
|
HTML_EL | |
|
|
TABLE_CELL_EL | |
|
|
TABLE_ROW_EL | |
|
|
TABLE_ROW_GROUP_EL |
|
|
} |
|
62 |
|
|
63 |
sub SCOPING_EL () { |
sub MISC_SPECIAL_EL () { SPECIAL_EL | 0b000 } |
64 |
BUTTON_EL | |
sub FORM_EL () { SPECIAL_EL | 0b001 } |
65 |
CAPTION_EL | |
sub FRAMESET_EL () { SPECIAL_EL | 0b010 } |
66 |
HTML_EL | |
sub HEADING_EL () { SPECIAL_EL | 0b011 } |
67 |
TABLE_EL | |
sub SELECT_EL () { SPECIAL_EL | 0b100 } |
68 |
TABLE_CELL_EL | |
sub SCRIPT_EL () { SPECIAL_EL | 0b101 } |
69 |
MISC_SCOPING_EL |
|
70 |
|
sub ADDRESS_DIV_EL () { SPECIAL_EL | ADDRESS_DIV_P_EL | 0b001 } |
71 |
|
sub BODY_EL () { SPECIAL_EL | ALL_END_TAG_OPTIONAL_EL | 0b001 } |
72 |
|
|
73 |
|
sub DD_EL () { |
74 |
|
SPECIAL_EL | |
75 |
|
END_TAG_OPTIONAL_EL | |
76 |
|
ALL_END_TAG_OPTIONAL_EL | |
77 |
|
0b001 |
78 |
} |
} |
79 |
|
sub DT_EL () { |
80 |
sub TABLE_SCOPING_EL () { |
SPECIAL_EL | |
81 |
HTML_EL | |
END_TAG_OPTIONAL_EL | |
82 |
TABLE_EL |
ALL_END_TAG_OPTIONAL_EL | |
83 |
|
0b010 |
84 |
} |
} |
85 |
|
sub LI_EL () { |
86 |
sub TABLE_ROWS_SCOPING_EL () { |
SPECIAL_EL | |
87 |
HTML_EL | |
END_TAG_OPTIONAL_EL | |
88 |
TABLE_ROW_GROUP_EL |
ALL_END_TAG_OPTIONAL_EL | |
89 |
|
0b100 |
90 |
|
} |
91 |
|
sub P_EL () { |
92 |
|
SPECIAL_EL | |
93 |
|
ADDRESS_DIV_P_EL | |
94 |
|
END_TAG_OPTIONAL_EL | |
95 |
|
ALL_END_TAG_OPTIONAL_EL | |
96 |
|
0b001 |
97 |
} |
} |
98 |
|
|
99 |
sub TABLE_ROW_SCOPING_EL () { |
sub TABLE_ROW_EL () { |
100 |
HTML_EL | |
SPECIAL_EL | |
101 |
TABLE_ROW_EL |
TABLE_ROWS_EL | |
102 |
|
TABLE_ROW_SCOPING_EL | |
103 |
|
ALL_END_TAG_OPTIONAL_EL | |
104 |
|
0b001 |
105 |
|
} |
106 |
|
sub TABLE_ROW_GROUP_EL () { |
107 |
|
SPECIAL_EL | |
108 |
|
TABLE_ROWS_EL | |
109 |
|
TABLE_ROWS_SCOPING_EL | |
110 |
|
ALL_END_TAG_OPTIONAL_EL | |
111 |
|
0b001 |
112 |
} |
} |
113 |
|
|
114 |
sub SPECIAL_EL () { |
sub MISC_SCOPING_EL () { SCOPING_EL | 0b000 } |
115 |
ADDRESS_EL | |
sub BUTTON_EL () { SCOPING_EL | 0b001 } |
116 |
BODY_EL | |
sub CAPTION_EL () { SCOPING_EL | 0b010 } |
117 |
DIV_EL | |
sub HTML_EL () { |
118 |
|
SCOPING_EL | |
119 |
DD_EL | |
TABLE_SCOPING_EL | |
120 |
DT_EL | |
TABLE_ROWS_SCOPING_EL | |
121 |
LI_EL | |
TABLE_ROW_SCOPING_EL | |
122 |
P_EL | |
ALL_END_TAG_OPTIONAL_EL | |
123 |
|
0b001 |
124 |
FORM_EL | |
} |
125 |
FRAMESET_EL | |
sub TABLE_EL () { |
126 |
HEADING_EL | |
SCOPING_EL | |
127 |
SELECT_EL | |
TABLE_ROWS_EL | |
128 |
TABLE_ROW_EL | |
TABLE_SCOPING_EL | |
129 |
TABLE_ROW_GROUP_EL | |
0b001 |
|
MISC_SPECIAL_EL |
|
130 |
} |
} |
131 |
|
sub TABLE_CELL_EL () { |
132 |
|
SCOPING_EL | |
133 |
|
TABLE_ROW_SCOPING_EL | |
134 |
|
ALL_END_TAG_OPTIONAL_EL | |
135 |
|
0b001 |
136 |
|
} |
137 |
|
|
138 |
|
sub MISC_FORMATTING_EL () { FORMATTING_EL | 0b000 } |
139 |
|
sub A_EL () { FORMATTING_EL | 0b001 } |
140 |
|
sub NOBR_EL () { FORMATTING_EL | 0b010 } |
141 |
|
|
142 |
|
sub RUBY_EL () { PHRASING_EL | 0b001 } |
143 |
|
|
144 |
|
## ISSUE: ALL_END_TAG_OPTIONAL_EL? |
145 |
|
sub OPTGROUP_EL () { PHRASING_EL | END_TAG_OPTIONAL_EL | 0b001 } |
146 |
|
sub OPTION_EL () { PHRASING_EL | END_TAG_OPTIONAL_EL | 0b010 } |
147 |
|
sub RUBY_COMPONENT_EL () { PHRASING_EL | END_TAG_OPTIONAL_EL | 0b100 } |
148 |
|
|
149 |
|
sub MML_AXML_EL () { PHRASING_EL | FOREIGN_EL | 0b001 } |
150 |
|
|
151 |
my $el_category = { |
my $el_category = { |
152 |
a => A_EL | FORMATTING_EL, |
a => A_EL, |
153 |
address => ADDRESS_EL, |
address => ADDRESS_DIV_EL, |
154 |
applet => MISC_SCOPING_EL, |
applet => MISC_SCOPING_EL, |
155 |
area => MISC_SPECIAL_EL, |
area => MISC_SPECIAL_EL, |
156 |
article => MISC_SPECIAL_EL, |
article => MISC_SPECIAL_EL, |
174 |
details => MISC_SPECIAL_EL, |
details => MISC_SPECIAL_EL, |
175 |
dialog => MISC_SPECIAL_EL, |
dialog => MISC_SPECIAL_EL, |
176 |
dir => MISC_SPECIAL_EL, |
dir => MISC_SPECIAL_EL, |
177 |
div => DIV_EL, |
div => ADDRESS_DIV_EL, |
178 |
dl => MISC_SPECIAL_EL, |
dl => MISC_SPECIAL_EL, |
179 |
dt => DT_EL, |
dt => DT_EL, |
180 |
em => FORMATTING_EL, |
em => FORMATTING_EL, |
210 |
menu => MISC_SPECIAL_EL, |
menu => MISC_SPECIAL_EL, |
211 |
meta => MISC_SPECIAL_EL, |
meta => MISC_SPECIAL_EL, |
212 |
nav => MISC_SPECIAL_EL, |
nav => MISC_SPECIAL_EL, |
213 |
nobr => NOBR_EL | FORMATTING_EL, |
nobr => NOBR_EL, |
214 |
noembed => MISC_SPECIAL_EL, |
noembed => MISC_SPECIAL_EL, |
215 |
noframes => MISC_SPECIAL_EL, |
noframes => MISC_SPECIAL_EL, |
216 |
noscript => MISC_SPECIAL_EL, |
noscript => MISC_SPECIAL_EL, |
252 |
my $el_category_f = { |
my $el_category_f = { |
253 |
$MML_NS => { |
$MML_NS => { |
254 |
'annotation-xml' => MML_AXML_EL, |
'annotation-xml' => MML_AXML_EL, |
255 |
mi => FOREIGN_FLOW_CONTENT_EL, |
mi => FOREIGN_EL | FOREIGN_FLOW_CONTENT_EL, |
256 |
mo => FOREIGN_FLOW_CONTENT_EL, |
mo => FOREIGN_EL | FOREIGN_FLOW_CONTENT_EL, |
257 |
mn => FOREIGN_FLOW_CONTENT_EL, |
mn => FOREIGN_EL | FOREIGN_FLOW_CONTENT_EL, |
258 |
ms => FOREIGN_FLOW_CONTENT_EL, |
ms => FOREIGN_EL | FOREIGN_FLOW_CONTENT_EL, |
259 |
mtext => FOREIGN_FLOW_CONTENT_EL, |
mtext => FOREIGN_EL | FOREIGN_FLOW_CONTENT_EL, |
260 |
}, |
}, |
261 |
$SVG_NS => { |
$SVG_NS => { |
262 |
foreignObject => FOREIGN_FLOW_CONTENT_EL | MISC_SCOPING_EL, |
foreignObject => SCOPING_EL | FOREIGN_EL | FOREIGN_FLOW_CONTENT_EL, |
263 |
desc => FOREIGN_FLOW_CONTENT_EL, |
desc => FOREIGN_EL | FOREIGN_FLOW_CONTENT_EL, |
264 |
title => FOREIGN_FLOW_CONTENT_EL, |
title => FOREIGN_EL | FOREIGN_FLOW_CONTENT_EL, |
265 |
}, |
}, |
266 |
## NOTE: In addition, FOREIGN_EL is set to non-HTML elements. |
## NOTE: In addition, FOREIGN_EL is set to non-HTML elements. |
267 |
}; |
}; |
3488 |
undef $self->{head_element_inserted}; |
undef $self->{head_element_inserted}; |
3489 |
$self->{open_elements} = []; |
$self->{open_elements} = []; |
3490 |
undef $self->{inner_html_node}; |
undef $self->{inner_html_node}; |
3491 |
|
undef $self->{ignore_newline}; |
3492 |
|
|
3493 |
## NOTE: The "initial" insertion mode. |
## NOTE: The "initial" insertion mode. |
3494 |
$self->_tree_construction_initial; # MUST |
$self->_tree_construction_initial; # MUST |
3829 |
## SVG elements. Currently the HTML syntax supports only MathML and |
## SVG elements. Currently the HTML syntax supports only MathML and |
3830 |
## SVG elements as foreigners. |
## SVG elements as foreigners. |
3831 |
$new_mode = IN_BODY_IM | IN_FOREIGN_CONTENT_IM; |
$new_mode = IN_BODY_IM | IN_FOREIGN_CONTENT_IM; |
3832 |
} elsif ($node->[1] & TABLE_CELL_EL) { |
} elsif ($node->[1] == TABLE_CELL_EL) { |
3833 |
if ($last) { |
if ($last) { |
3834 |
!!!cp ('t28.2'); |
!!!cp ('t28.2'); |
3835 |
# |
# |
3858 |
$self->{insertion_mode} = $new_mode and return if defined $new_mode; |
$self->{insertion_mode} = $new_mode and return if defined $new_mode; |
3859 |
|
|
3860 |
## Step 15 |
## Step 15 |
3861 |
if ($node->[1] & HTML_EL) { |
if ($node->[1] == HTML_EL) { |
3862 |
unless (defined $self->{head_element}) { |
unless (defined $self->{head_element}) { |
3863 |
!!!cp ('t29'); |
!!!cp ('t29'); |
3864 |
$self->{insertion_mode} = BEFORE_HEAD_IM; |
$self->{insertion_mode} = BEFORE_HEAD_IM; |
4205 |
my $foster_parent_element; |
my $foster_parent_element; |
4206 |
my $next_sibling; |
my $next_sibling; |
4207 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
4208 |
if ($self->{open_elements}->[$_]->[1] & TABLE_EL) { |
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
4209 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
4210 |
if (defined $parent and $parent->node_type == 1) { |
if (defined $parent and $parent->node_type == 1) { |
4211 |
!!!cp ('t65.1'); |
!!!cp ('t65.1'); |
4283 |
my $foster_parent_element; |
my $foster_parent_element; |
4284 |
my $next_sibling; |
my $next_sibling; |
4285 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
4286 |
if ($self->{open_elements}->[$_]->[1] & TABLE_EL) { |
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
4287 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
4288 |
if (defined $parent and $parent->node_type == 1) { |
if (defined $parent and $parent->node_type == 1) { |
4289 |
!!!cp ('t70'); |
!!!cp ('t70'); |
4439 |
->manakai_local_name, |
->manakai_local_name, |
4440 |
token => $token); |
token => $token); |
4441 |
|
|
4442 |
#if ($self->{open_elements}->[-1]->[1] & SCRIPT_EL) { |
#if ($self->{open_elements}->[-1]->[1] == SCRIPT_EL) { |
4443 |
# ## TODO: Mark as "already executed" |
# ## TODO: Mark as "already executed" |
4444 |
#} |
#} |
4445 |
|
|
4462 |
$self->{open_elements}->[-1]->[1] & FOREIGN_FLOW_CONTENT_EL) or |
$self->{open_elements}->[-1]->[1] & FOREIGN_FLOW_CONTENT_EL) or |
4463 |
not ($self->{open_elements}->[-1]->[1] & FOREIGN_EL) or |
not ($self->{open_elements}->[-1]->[1] & FOREIGN_EL) or |
4464 |
($token->{tag_name} eq 'svg' and |
($token->{tag_name} eq 'svg' and |
4465 |
$self->{open_elements}->[-1]->[1] & MML_AXML_EL)) { |
$self->{open_elements}->[-1]->[1] == MML_AXML_EL)) { |
4466 |
## NOTE: "using the rules for secondary insertion mode"then"continue" |
## NOTE: "using the rules for secondary insertion mode"then"continue" |
4467 |
!!!cp ('t87.2'); |
!!!cp ('t87.2'); |
4468 |
# |
# |
5252 |
## have an element in table scope |
## have an element in table scope |
5253 |
for (reverse 0..$#{$self->{open_elements}}) { |
for (reverse 0..$#{$self->{open_elements}}) { |
5254 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5255 |
if ($node->[1] & TABLE_CELL_EL) { |
if ($node->[1] == TABLE_CELL_EL) { |
5256 |
!!!cp ('t151'); |
!!!cp ('t151'); |
5257 |
|
|
5258 |
## Close the cell |
## Close the cell |
5286 |
INSCOPE: { |
INSCOPE: { |
5287 |
for (reverse 0..$#{$self->{open_elements}}) { |
for (reverse 0..$#{$self->{open_elements}}) { |
5288 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5289 |
if ($node->[1] & CAPTION_EL) { |
if ($node->[1] == CAPTION_EL) { |
5290 |
!!!cp ('t155'); |
!!!cp ('t155'); |
5291 |
$i = $_; |
$i = $_; |
5292 |
last INSCOPE; |
last INSCOPE; |
5312 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5313 |
} |
} |
5314 |
|
|
5315 |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
unless ($self->{open_elements}->[-1]->[1] == CAPTION_EL) { |
5316 |
!!!cp ('t159'); |
!!!cp ('t159'); |
5317 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
5318 |
text => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
5409 |
INSCOPE: { |
INSCOPE: { |
5410 |
for (reverse 0..$#{$self->{open_elements}}) { |
for (reverse 0..$#{$self->{open_elements}}) { |
5411 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5412 |
if ($node->[1] & CAPTION_EL) { |
if ($node->[1] == CAPTION_EL) { |
5413 |
!!!cp ('t171'); |
!!!cp ('t171'); |
5414 |
$i = $_; |
$i = $_; |
5415 |
last INSCOPE; |
last INSCOPE; |
5434 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5435 |
} |
} |
5436 |
|
|
5437 |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
unless ($self->{open_elements}->[-1]->[1] == CAPTION_EL) { |
5438 |
!!!cp ('t175'); |
!!!cp ('t175'); |
5439 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
5440 |
text => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
5484 |
line => $token->{line}, |
line => $token->{line}, |
5485 |
column => $token->{column}}; |
column => $token->{column}}; |
5486 |
next B; |
next B; |
5487 |
} elsif ($node->[1] & TABLE_CELL_EL) { |
} elsif ($node->[1] == TABLE_CELL_EL) { |
5488 |
!!!cp ('t180'); |
!!!cp ('t180'); |
5489 |
$tn = $node->[0]->manakai_local_name; |
$tn = $node->[0]->manakai_local_name; |
5490 |
## NOTE: There is exactly one |td| or |th| element |
## NOTE: There is exactly one |td| or |th| element |
5513 |
my $i; |
my $i; |
5514 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5515 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5516 |
if ($node->[1] & CAPTION_EL) { |
if ($node->[1] == CAPTION_EL) { |
5517 |
!!!cp ('t184'); |
!!!cp ('t184'); |
5518 |
$i = $_; |
$i = $_; |
5519 |
last INSCOPE; |
last INSCOPE; |
5537 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5538 |
} |
} |
5539 |
|
|
5540 |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
unless ($self->{open_elements}->[-1]->[1] == CAPTION_EL) { |
5541 |
!!!cp ('t188'); |
!!!cp ('t188'); |
5542 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
5543 |
text => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
5627 |
my $next_sibling; |
my $next_sibling; |
5628 |
my $prev_sibling; |
my $prev_sibling; |
5629 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
5630 |
if ($self->{open_elements}->[$_]->[1] & TABLE_EL) { |
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
5631 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
5632 |
if (defined $parent and $parent->node_type == 1) { |
if (defined $parent and $parent->node_type == 1) { |
5633 |
$foster_parent_element = $parent; |
$foster_parent_element = $parent; |
5750 |
my $i; |
my $i; |
5751 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5752 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5753 |
if ($node->[1] & TABLE_ROW_EL) { |
if ($node->[1] == TABLE_ROW_EL) { |
5754 |
!!!cp ('t208'); |
!!!cp ('t208'); |
5755 |
$i = $_; |
$i = $_; |
5756 |
last INSCOPE; |
last INSCOPE; |
5796 |
my $i; |
my $i; |
5797 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5798 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5799 |
if ($node->[1] & TABLE_ROW_GROUP_EL) { |
if ($node->[1] == TABLE_ROW_GROUP_EL) { |
5800 |
!!!cp ('t214'); |
!!!cp ('t214'); |
5801 |
$i = $_; |
$i = $_; |
5802 |
last INSCOPE; |
last INSCOPE; |
5895 |
my $i; |
my $i; |
5896 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5897 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5898 |
if ($node->[1] & TABLE_EL) { |
if ($node->[1] == TABLE_EL) { |
5899 |
!!!cp ('t221'); |
!!!cp ('t221'); |
5900 |
$i = $_; |
$i = $_; |
5901 |
last INSCOPE; |
last INSCOPE; |
5922 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5923 |
} |
} |
5924 |
|
|
5925 |
unless ($self->{open_elements}->[-1]->[1] & TABLE_EL) { |
unless ($self->{open_elements}->[-1]->[1] == TABLE_EL) { |
5926 |
!!!cp ('t225'); |
!!!cp ('t225'); |
5927 |
## NOTE: |<table><tr><table>| |
## NOTE: |<table><tr><table>| |
5928 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
6011 |
my $i; |
my $i; |
6012 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6013 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
6014 |
if ($node->[1] & TABLE_ROW_EL) { |
if ($node->[1] == TABLE_ROW_EL) { |
6015 |
!!!cp ('t228'); |
!!!cp ('t228'); |
6016 |
$i = $_; |
$i = $_; |
6017 |
last INSCOPE; |
last INSCOPE; |
6052 |
my $i; |
my $i; |
6053 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6054 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
6055 |
if ($node->[1] & TABLE_ROW_EL) { |
if ($node->[1] == TABLE_ROW_EL) { |
6056 |
!!!cp ('t233'); |
!!!cp ('t233'); |
6057 |
$i = $_; |
$i = $_; |
6058 |
last INSCOPE; |
last INSCOPE; |
6090 |
my $i; |
my $i; |
6091 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6092 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
6093 |
if ($node->[1] & TABLE_ROW_GROUP_EL) { |
if ($node->[1] == TABLE_ROW_GROUP_EL) { |
6094 |
!!!cp ('t237'); |
!!!cp ('t237'); |
6095 |
$i = $_; |
$i = $_; |
6096 |
last INSCOPE; |
last INSCOPE; |
6137 |
my $i; |
my $i; |
6138 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6139 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
6140 |
if ($node->[1] & TABLE_EL) { |
if ($node->[1] == TABLE_EL) { |
6141 |
!!!cp ('t241'); |
!!!cp ('t241'); |
6142 |
$i = $_; |
$i = $_; |
6143 |
last INSCOPE; |
last INSCOPE; |
6196 |
my $i; |
my $i; |
6197 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6198 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
6199 |
if ($node->[1] & TABLE_ROW_EL) { |
if ($node->[1] == TABLE_ROW_EL) { |
6200 |
!!!cp ('t250'); |
!!!cp ('t250'); |
6201 |
$i = $_; |
$i = $_; |
6202 |
last INSCOPE; |
last INSCOPE; |
6286 |
# |
# |
6287 |
} |
} |
6288 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
6289 |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
unless ($self->{open_elements}->[-1]->[1] == HTML_EL and |
6290 |
@{$self->{open_elements}} == 1) { # redundant, maybe |
@{$self->{open_elements}} == 1) { # redundant, maybe |
6291 |
!!!parse-error (type => 'in body:#eof', token => $token); |
!!!parse-error (type => 'in body:#eof', token => $token); |
6292 |
!!!cp ('t259.1'); |
!!!cp ('t259.1'); |
6328 |
} |
} |
6329 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
6330 |
if ($token->{tag_name} eq 'colgroup') { |
if ($token->{tag_name} eq 'colgroup') { |
6331 |
if ($self->{open_elements}->[-1]->[1] & HTML_EL) { |
if ($self->{open_elements}->[-1]->[1] == HTML_EL) { |
6332 |
!!!cp ('t264'); |
!!!cp ('t264'); |
6333 |
!!!parse-error (type => 'unmatched end tag', |
!!!parse-error (type => 'unmatched end tag', |
6334 |
text => 'colgroup', token => $token); |
text => 'colgroup', token => $token); |
6354 |
# |
# |
6355 |
} |
} |
6356 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
6357 |
if ($self->{open_elements}->[-1]->[1] & HTML_EL and |
if ($self->{open_elements}->[-1]->[1] == HTML_EL and |
6358 |
@{$self->{open_elements}} == 1) { # redundant, maybe |
@{$self->{open_elements}} == 1) { # redundant, maybe |
6359 |
!!!cp ('t270.2'); |
!!!cp ('t270.2'); |
6360 |
## Stop parsing. |
## Stop parsing. |
6372 |
} |
} |
6373 |
|
|
6374 |
## As if </colgroup> |
## As if </colgroup> |
6375 |
if ($self->{open_elements}->[-1]->[1] & HTML_EL) { |
if ($self->{open_elements}->[-1]->[1] == HTML_EL) { |
6376 |
!!!cp ('t269'); |
!!!cp ('t269'); |
6377 |
## TODO: Wrong error type? |
## TODO: Wrong error type? |
6378 |
!!!parse-error (type => 'unmatched end tag', |
!!!parse-error (type => 'unmatched end tag', |
6397 |
next B; |
next B; |
6398 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
6399 |
if ($token->{tag_name} eq 'option') { |
if ($token->{tag_name} eq 'option') { |
6400 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] == OPTION_EL) { |
6401 |
!!!cp ('t272'); |
!!!cp ('t272'); |
6402 |
## As if </option> |
## As if </option> |
6403 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6410 |
!!!next-token; |
!!!next-token; |
6411 |
next B; |
next B; |
6412 |
} elsif ($token->{tag_name} eq 'optgroup') { |
} elsif ($token->{tag_name} eq 'optgroup') { |
6413 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] == OPTION_EL) { |
6414 |
!!!cp ('t274'); |
!!!cp ('t274'); |
6415 |
## As if </option> |
## As if </option> |
6416 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6418 |
!!!cp ('t275'); |
!!!cp ('t275'); |
6419 |
} |
} |
6420 |
|
|
6421 |
if ($self->{open_elements}->[-1]->[1] & OPTGROUP_EL) { |
if ($self->{open_elements}->[-1]->[1] == OPTGROUP_EL) { |
6422 |
!!!cp ('t276'); |
!!!cp ('t276'); |
6423 |
## As if </optgroup> |
## As if </optgroup> |
6424 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6448 |
my $i; |
my $i; |
6449 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6450 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
6451 |
if ($node->[1] & SELECT_EL) { |
if ($node->[1] == SELECT_EL) { |
6452 |
!!!cp ('t278'); |
!!!cp ('t278'); |
6453 |
$i = $_; |
$i = $_; |
6454 |
last INSCOPE; |
last INSCOPE; |
6493 |
} |
} |
6494 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
6495 |
if ($token->{tag_name} eq 'optgroup') { |
if ($token->{tag_name} eq 'optgroup') { |
6496 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL and |
if ($self->{open_elements}->[-1]->[1] == OPTION_EL and |
6497 |
$self->{open_elements}->[-2]->[1] & OPTGROUP_EL) { |
$self->{open_elements}->[-2]->[1] == OPTGROUP_EL) { |
6498 |
!!!cp ('t283'); |
!!!cp ('t283'); |
6499 |
## As if </option> |
## As if </option> |
6500 |
splice @{$self->{open_elements}}, -2; |
splice @{$self->{open_elements}}, -2; |
6501 |
} elsif ($self->{open_elements}->[-1]->[1] & OPTGROUP_EL) { |
} elsif ($self->{open_elements}->[-1]->[1] == OPTGROUP_EL) { |
6502 |
!!!cp ('t284'); |
!!!cp ('t284'); |
6503 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6504 |
} else { |
} else { |
6511 |
!!!next-token; |
!!!next-token; |
6512 |
next B; |
next B; |
6513 |
} elsif ($token->{tag_name} eq 'option') { |
} elsif ($token->{tag_name} eq 'option') { |
6514 |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
if ($self->{open_elements}->[-1]->[1] == OPTION_EL) { |
6515 |
!!!cp ('t286'); |
!!!cp ('t286'); |
6516 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6517 |
} else { |
} else { |
6528 |
my $i; |
my $i; |
6529 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6530 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
6531 |
if ($node->[1] & SELECT_EL) { |
if ($node->[1] == SELECT_EL) { |
6532 |
!!!cp ('t288'); |
!!!cp ('t288'); |
6533 |
$i = $_; |
$i = $_; |
6534 |
last INSCOPE; |
last INSCOPE; |
6590 |
undef $i; |
undef $i; |
6591 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
6592 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
6593 |
if ($node->[1] & SELECT_EL) { |
if ($node->[1] == SELECT_EL) { |
6594 |
!!!cp ('t295'); |
!!!cp ('t295'); |
6595 |
$i = $_; |
$i = $_; |
6596 |
last INSCOPE; |
last INSCOPE; |
6629 |
next B; |
next B; |
6630 |
} |
} |
6631 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
6632 |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
unless ($self->{open_elements}->[-1]->[1] == HTML_EL and |
6633 |
@{$self->{open_elements}} == 1) { # redundant, maybe |
@{$self->{open_elements}} == 1) { # redundant, maybe |
6634 |
!!!cp ('t299.1'); |
!!!cp ('t299.1'); |
6635 |
!!!parse-error (type => 'in body:#eof', token => $token); |
!!!parse-error (type => 'in body:#eof', token => $token); |
6816 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
6817 |
if ($token->{tag_name} eq 'frameset' and |
if ($token->{tag_name} eq 'frameset' and |
6818 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
6819 |
if ($self->{open_elements}->[-1]->[1] & HTML_EL and |
if ($self->{open_elements}->[-1]->[1] == HTML_EL and |
6820 |
@{$self->{open_elements}} == 1) { |
@{$self->{open_elements}} == 1) { |
6821 |
!!!cp ('t325'); |
!!!cp ('t325'); |
6822 |
!!!parse-error (type => 'unmatched end tag', |
!!!parse-error (type => 'unmatched end tag', |
6830 |
} |
} |
6831 |
|
|
6832 |
if (not defined $self->{inner_html_node} and |
if (not defined $self->{inner_html_node} and |
6833 |
not ($self->{open_elements}->[-1]->[1] & FRAMESET_EL)) { |
not ($self->{open_elements}->[-1]->[1] == FRAMESET_EL)) { |
6834 |
!!!cp ('t327'); |
!!!cp ('t327'); |
6835 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
6836 |
} else { |
} else { |
6862 |
next B; |
next B; |
6863 |
} |
} |
6864 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
6865 |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
unless ($self->{open_elements}->[-1]->[1] == HTML_EL and |
6866 |
@{$self->{open_elements}} == 1) { # redundant, maybe |
@{$self->{open_elements}} == 1) { # redundant, maybe |
6867 |
!!!cp ('t331.1'); |
!!!cp ('t331.1'); |
6868 |
!!!parse-error (type => 'in body:#eof', token => $token); |
!!!parse-error (type => 'in body:#eof', token => $token); |
6965 |
!!!parse-error (type => 'in body', text => 'body', token => $token); |
!!!parse-error (type => 'in body', text => 'body', token => $token); |
6966 |
|
|
6967 |
if (@{$self->{open_elements}} == 1 or |
if (@{$self->{open_elements}} == 1 or |
6968 |
not ($self->{open_elements}->[1]->[1] & BODY_EL)) { |
not ($self->{open_elements}->[1]->[1] == BODY_EL)) { |
6969 |
!!!cp ('t342'); |
!!!cp ('t342'); |
6970 |
## Ignore the token |
## Ignore the token |
6971 |
} else { |
} else { |
7011 |
|
|
7012 |
## has a p element in scope |
## has a p element in scope |
7013 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
7014 |
if ($_->[1] & P_EL) { |
if ($_->[1] == P_EL) { |
7015 |
!!!cp ('t344'); |
!!!cp ('t344'); |
7016 |
!!!back-token; # <form> |
!!!back-token; # <form> |
7017 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
7084 |
|
|
7085 |
## 1. |
## 1. |
7086 |
for my $node (reverse @{$self->{open_elements}}) { |
for my $node (reverse @{$self->{open_elements}}) { |
7087 |
if ($node->[1] & LI_EL) { |
if ($node->[1] == LI_EL) { |
7088 |
## 2. (a) As if </li> |
## 2. (a) As if </li> |
7089 |
{ |
{ |
7090 |
## If no </li> - not applied |
## If no </li> - not applied |
7115 |
($node->[1] & SPECIAL_EL or |
($node->[1] & SPECIAL_EL or |
7116 |
$node->[1] & SCOPING_EL) and |
$node->[1] & SCOPING_EL) and |
7117 |
## NOTE: "li", "dt", and "dd" are in |SPECIAL_EL|. |
## NOTE: "li", "dt", and "dd" are in |SPECIAL_EL|. |
7118 |
|
(not $node->[1] & ADDRESS_DIV_P_EL) |
7119 |
(not $node->[1] & ADDRESS_EL) & |
) { |
|
(not $node->[1] & DIV_EL) & |
|
|
(not $node->[1] & P_EL)) { |
|
7120 |
## 3. |
## 3. |
7121 |
!!!cp ('t357'); |
!!!cp ('t357'); |
7122 |
last; ## goto 5. |
last; ## goto 5. |
7135 |
|
|
7136 |
## 5. (a) has a |p| element in scope |
## 5. (a) has a |p| element in scope |
7137 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
7138 |
if ($_->[1] & P_EL) { |
if ($_->[1] == P_EL) { |
7139 |
!!!cp ('t353'); |
!!!cp ('t353'); |
7140 |
|
|
7141 |
## NOTE: |<p><li>|, for example. |
## NOTE: |<p><li>|, for example. |
7164 |
|
|
7165 |
## 1. |
## 1. |
7166 |
for my $node (reverse @{$self->{open_elements}}) { |
for my $node (reverse @{$self->{open_elements}}) { |
7167 |
if ($node->[1] & DT_EL or $node->[1] & DD_EL) { |
if ($node->[1] == DT_EL or $node->[1] == DD_EL) { |
7168 |
## 2. (a) As if </li> |
## 2. (a) As if </li> |
7169 |
{ |
{ |
7170 |
## If no </li> - not applied |
## If no </li> - not applied |
7196 |
$node->[1] & SCOPING_EL) and |
$node->[1] & SCOPING_EL) and |
7197 |
## NOTE: "li", "dt", and "dd" are in |SPECIAL_EL|. |
## NOTE: "li", "dt", and "dd" are in |SPECIAL_EL|. |
7198 |
|
|
7199 |
(not $node->[1] & ADDRESS_EL) & |
(not $node->[1] & ADDRESS_DIV_P_EL) |
7200 |
(not $node->[1] & DIV_EL) & |
) { |
|
(not $node->[1] & P_EL)) { |
|
7201 |
## 3. |
## 3. |
7202 |
!!!cp ('t357.1'); |
!!!cp ('t357.1'); |
7203 |
last; ## goto 5. |
last; ## goto 5. |
7216 |
|
|
7217 |
## 5. (a) has a |p| element in scope |
## 5. (a) has a |p| element in scope |
7218 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
7219 |
if ($_->[1] & P_EL) { |
if ($_->[1] == P_EL) { |
7220 |
!!!cp ('t353.1'); |
!!!cp ('t353.1'); |
7221 |
!!!back-token; # <x> |
!!!back-token; # <x> |
7222 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
7238 |
|
|
7239 |
## has a p element in scope |
## has a p element in scope |
7240 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
7241 |
if ($_->[1] & P_EL) { |
if ($_->[1] == P_EL) { |
7242 |
!!!cp ('t367'); |
!!!cp ('t367'); |
7243 |
!!!back-token; # <plaintext> |
!!!back-token; # <plaintext> |
7244 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
7260 |
} elsif ($token->{tag_name} eq 'a') { |
} elsif ($token->{tag_name} eq 'a') { |
7261 |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
7262 |
my $node = $active_formatting_elements->[$i]; |
my $node = $active_formatting_elements->[$i]; |
7263 |
if ($node->[1] & A_EL) { |
if ($node->[1] == A_EL) { |
7264 |
!!!cp ('t371'); |
!!!cp ('t371'); |
7265 |
!!!parse-error (type => 'in a:a', token => $token); |
!!!parse-error (type => 'in a:a', token => $token); |
7266 |
|
|
7304 |
## has a |nobr| element in scope |
## has a |nobr| element in scope |
7305 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
7306 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
7307 |
if ($node->[1] & NOBR_EL) { |
if ($node->[1] == NOBR_EL) { |
7308 |
!!!cp ('t376'); |
!!!cp ('t376'); |
7309 |
!!!parse-error (type => 'in nobr:nobr', token => $token); |
!!!parse-error (type => 'in nobr:nobr', token => $token); |
7310 |
!!!back-token; # <nobr> |
!!!back-token; # <nobr> |
7327 |
## has a button element in scope |
## has a button element in scope |
7328 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
7329 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
7330 |
if ($node->[1] & BUTTON_EL) { |
if ($node->[1] == BUTTON_EL) { |
7331 |
!!!cp ('t378'); |
!!!cp ('t378'); |
7332 |
!!!parse-error (type => 'in button:button', token => $token); |
!!!parse-error (type => 'in button:button', token => $token); |
7333 |
!!!back-token; # <button> |
!!!back-token; # <button> |
7454 |
## has an |option| element in scope |
## has an |option| element in scope |
7455 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
7456 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
7457 |
if ($node->[1] & OPTION_EL) { |
if ($node->[1] == OPTION_EL) { |
7458 |
!!!cp ('t397.1'); |
!!!cp ('t397.1'); |
7459 |
## NOTE: As if </option> |
## NOTE: As if </option> |
7460 |
!!!back-token; # <option> or <optgroup> |
!!!back-token; # <option> or <optgroup> |
7479 |
## has a |ruby| element in scope |
## has a |ruby| element in scope |
7480 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
7481 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
7482 |
if ($node->[1] & RUBY_EL) { |
if ($node->[1] == RUBY_EL) { |
7483 |
!!!cp ('t398.1'); |
!!!cp ('t398.1'); |
7484 |
## generate implied end tags |
## generate implied end tags |
7485 |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
7486 |
!!!cp ('t398.2'); |
!!!cp ('t398.2'); |
7487 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
7488 |
} |
} |
7489 |
unless ($self->{open_elements}->[-1]->[1] & RUBY_EL) { |
unless ($self->{open_elements}->[-1]->[1] == RUBY_EL) { |
7490 |
!!!cp ('t398.3'); |
!!!cp ('t398.3'); |
7491 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
7492 |
text => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
7493 |
->manakai_local_name, |
->manakai_local_name, |
7494 |
token => $token); |
token => $token); |
7495 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
7496 |
while not $self->{open_elements}->[-1]->[1] & RUBY_EL; |
while not $self->{open_elements}->[-1]->[1] == RUBY_EL; |
7497 |
} |
} |
7498 |
last INSCOPE; |
last INSCOPE; |
7499 |
} elsif ($node->[1] & SCOPING_EL) { |
} elsif ($node->[1] & SCOPING_EL) { |
7619 |
my $i; |
my $i; |
7620 |
INSCOPE: { |
INSCOPE: { |
7621 |
for (reverse @{$self->{open_elements}}) { |
for (reverse @{$self->{open_elements}}) { |
7622 |
if ($_->[1] & BODY_EL) { |
if ($_->[1] == BODY_EL) { |
7623 |
!!!cp ('t405'); |
!!!cp ('t405'); |
7624 |
$i = $_; |
$i = $_; |
7625 |
last INSCOPE; |
last INSCOPE; |
7657 |
## TODO: Update this code. It seems that the code below is not |
## TODO: Update this code. It seems that the code below is not |
7658 |
## up-to-date, though it has same effect as speced. |
## up-to-date, though it has same effect as speced. |
7659 |
if (@{$self->{open_elements}} > 1 and |
if (@{$self->{open_elements}} > 1 and |
7660 |
$self->{open_elements}->[1]->[1] & BODY_EL) { |
$self->{open_elements}->[1]->[1] == BODY_EL) { |
7661 |
unless ($self->{open_elements}->[-1]->[1] & BODY_EL) { |
unless ($self->{open_elements}->[-1]->[1] == BODY_EL) { |
7662 |
!!!cp ('t406'); |
!!!cp ('t406'); |
7663 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
7664 |
text => $self->{open_elements}->[1]->[0] |
text => $self->{open_elements}->[1]->[0] |
7765 |
my $i; |
my $i; |
7766 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
7767 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
7768 |
if ($node->[1] & FORM_EL) { |
if ($node->[1] == FORM_EL) { |
7769 |
!!!cp ('t418'); |
!!!cp ('t418'); |
7770 |
$i = $_; |
$i = $_; |
7771 |
last INSCOPE; |
last INSCOPE; |
7813 |
my $i; |
my $i; |
7814 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
7815 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
7816 |
if ($node->[1] & HEADING_EL) { |
if ($node->[1] == HEADING_EL) { |
7817 |
!!!cp ('t423'); |
!!!cp ('t423'); |
7818 |
$i = $_; |
$i = $_; |
7819 |
last INSCOPE; |
last INSCOPE; |
7859 |
my $i; |
my $i; |
7860 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
7861 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
7862 |
if ($node->[1] & P_EL) { |
if ($node->[1] == P_EL) { |
7863 |
!!!cp ('t410.1'); |
!!!cp ('t410.1'); |
7864 |
$i = $_; |
$i = $_; |
7865 |
last INSCOPE; |
last INSCOPE; |