2265 |
|
|
2266 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
2267 |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
2268 |
## ISSUE: A spec bug [Bug 6038] |
|
2269 |
|
## NOTE: At this point the stack of open elements contain |
2270 |
|
## the |head| element (index == -2) and the |script| element |
2271 |
|
## (index == -1). In the "after head" insertion mode the |
2272 |
|
## |head| element is inserted only for the purpose of |
2273 |
|
## providing the context for the |script| element, and |
2274 |
|
## therefore we can now and have to remove the element from |
2275 |
|
## the stack. |
2276 |
splice @{$self->{open_elements}}, -2, 1, () # <head> |
splice @{$self->{open_elements}}, -2, 1, () # <head> |
2277 |
if ($self->{insertion_mode} & IM_MASK) == AFTER_HEAD_IM; |
if ($self->{insertion_mode} & IM_MASK) == AFTER_HEAD_IM; |
2278 |
next B; |
next B; |
4433 |
table => 1, |
table => 1, |
4434 |
hr => 1, |
hr => 1, |
4435 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4436 |
|
|
4437 |
|
## 1. When there is an opening |form| element: |
4438 |
if ($token->{tag_name} eq 'form' and defined $self->{form_element}) { |
if ($token->{tag_name} eq 'form' and defined $self->{form_element}) { |
4439 |
!!!cp ('t350'); |
!!!cp ('t350'); |
4440 |
!!!parse-error (type => 'in form:form', token => $token); |
!!!parse-error (type => 'in form:form', token => $token); |
4444 |
next B; |
next B; |
4445 |
} |
} |
4446 |
|
|
4447 |
|
## 2. Close the |p| element, if any. |
4448 |
if ($token->{tag_name} ne 'table' or # The Hixie Quirk |
if ($token->{tag_name} ne 'table' or # The Hixie Quirk |
4449 |
$self->{document}->manakai_compat_mode ne 'quirks') { |
$self->{document}->manakai_compat_mode ne 'quirks') { |
4450 |
## has a p element in scope |
## has a p element in scope |
4461 |
} |
} |
4462 |
} # INSCOPE |
} # INSCOPE |
4463 |
} |
} |
4464 |
|
|
4465 |
|
## 3. Close the opening <hn> element, if any. |
4466 |
|
if ({h1 => 1, h2 => 1, h3 => 1, |
4467 |
|
h4 => 1, h5 => 1, h6 => 1}->{$token->{tag_name}}) { |
4468 |
|
if ($self->{open_elements}->[-1]->[1] == HEADING_EL) { |
4469 |
|
!!!parse-error (type => 'not closed', |
4470 |
|
text => $self->{open_elements}->[-1]->[0]->manakai_local_name, |
4471 |
|
token => $token); |
4472 |
|
pop @{$self->{open_elements}}; |
4473 |
|
} |
4474 |
|
} |
4475 |
|
|
4476 |
|
## 4. Insertion. |
4477 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
4478 |
if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') { |
if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') { |
4479 |
!!!nack ('t346.1'); |
!!!nack ('t346.1'); |
4517 |
} elsif ($token->{tag_name} eq 'li') { |
} elsif ($token->{tag_name} eq 'li') { |
4518 |
## NOTE: As normal, but imply </li> when there's another <li> ... |
## NOTE: As normal, but imply </li> when there's another <li> ... |
4519 |
|
|
4520 |
## NOTE: Special, Scope (<li><foo><li> == <li><foo><li/></foo></li>) |
## NOTE: Special, Scope (<li><foo><li> == <li><foo><li/></foo></li>):: |
4521 |
## Interpreted as <li><foo/></li><li/> (non-conforming) |
## Interpreted as <li><foo/></li><li/> (non-conforming): |
4522 |
## blockquote (O9.27), center (O), dd (Fx3, O, S3.1.2, IE7), |
## blockquote (O9.27), center (O), dd (Fx3, O, S3.1.2, IE7), |
4523 |
## dt (Fx, O, S, IE), dl (O), fieldset (O, S, IE), form (Fx, O, S), |
## dt (Fx, O, S, IE), dl (O), fieldset (O, S, IE), form (Fx, O, S), |
4524 |
## hn (O), pre (O), applet (O, S), button (O, S), marquee (Fx, O, S), |
## hn (O), pre (O), applet (O, S), button (O, S), marquee (Fx, O, S), |
4525 |
## object (Fx) |
## object (Fx) |
4526 |
## Generate non-tree (non-conforming) |
## Generate non-tree (non-conforming): |
4527 |
## basefont (IE7 (where basefont is non-void)), center (IE), |
## basefont (IE7 (where basefont is non-void)), center (IE), |
4528 |
## form (IE), hn (IE) |
## form (IE), hn (IE) |
4529 |
## address, div, p (<li><foo><li> == <li><foo/></li><li/>) |
## address, div, p (<li><foo><li> == <li><foo/></li><li/>):: |
4530 |
## Interpreted as <li><foo><li/></foo></li> (non-conforming) |
## Interpreted as <li><foo><li/></foo></li> (non-conforming): |
4531 |
## div (Fx, S) |
## div (Fx, S) |
4532 |
|
|
4533 |
my $non_optional; |
my $non_optional; |
5063 |
} |
} |
5064 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
5065 |
if ($token->{tag_name} eq 'body') { |
if ($token->{tag_name} eq 'body') { |
5066 |
## has a |body| element in scope |
|
5067 |
|
## 1. If not "have an element in scope": |
5068 |
|
## "has a |body| element in scope" |
5069 |
my $i; |
my $i; |
5070 |
INSCOPE: { |
INSCOPE: { |
5071 |
for (reverse @{$self->{open_elements}}) { |
for (reverse @{$self->{open_elements}}) { |
5088 |
next B; |
next B; |
5089 |
} # INSCOPE |
} # INSCOPE |
5090 |
|
|
5091 |
|
## 2. If unclosed elements: |
5092 |
for (@{$self->{open_elements}}) { |
for (@{$self->{open_elements}}) { |
5093 |
unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL || |
unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL || |
5094 |
$_->[1] == OPTGROUP_EL || |
$_->[1] == OPTGROUP_EL || |
5104 |
} |
} |
5105 |
} |
} |
5106 |
|
|
5107 |
|
## 3. Switch the insertion mode. |
5108 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
5109 |
!!!next-token; |
!!!next-token; |
5110 |
next B; |
next B; |