| 1934 |
} elsif ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM) { |
} elsif ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM) { |
| 1935 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 1936 |
!!!cp ('t87.1'); |
!!!cp ('t87.1'); |
| 1937 |
|
|
| 1938 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 1939 |
|
|
| 1940 |
|
if ($token->{data} =~ /[^\x09\x0A\x0C\x0D\x20]/) { |
| 1941 |
|
delete $self->{frameset_ok}; |
| 1942 |
|
} |
| 1943 |
|
|
| 1944 |
!!!next-token; |
!!!next-token; |
| 1945 |
next B; |
next B; |
| 1946 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 2135 |
## As if <body> |
## As if <body> |
| 2136 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 2137 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 2138 |
## reprocess |
## The "frameset-ok" flag is left unchanged in this case. |
| 2139 |
|
## Reporcess the token. |
| 2140 |
next B; |
next B; |
| 2141 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 2142 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
| 2429 |
next B; |
next B; |
| 2430 |
} elsif ($token->{tag_name} eq 'body' or |
} elsif ($token->{tag_name} eq 'body' or |
| 2431 |
$token->{tag_name} eq 'frameset') { |
$token->{tag_name} eq 'frameset') { |
| 2432 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 2433 |
!!!cp ('t122'); |
!!!cp ('t122'); |
| 2434 |
## As if </noscript> |
## As if </noscript> |
| 2435 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 2436 |
!!!parse-error (type => 'in noscript', |
!!!parse-error (type => 'in noscript', |
| 2437 |
text => $token->{tag_name}, token => $token); |
text => $token->{tag_name}, token => $token); |
| 2438 |
|
|
| 2439 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
| 2440 |
## As if </head> |
## As if </head> |
| 2441 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 2442 |
|
|
| 2443 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
| 2444 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
| 2445 |
!!!cp ('t124'); |
!!!cp ('t124'); |
| 2446 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 2447 |
|
|
| 2448 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
| 2449 |
} else { |
} else { |
| 2450 |
!!!cp ('t125'); |
!!!cp ('t125'); |
| 2451 |
} |
} |
| 2452 |
|
|
| 2453 |
## "after head" insertion mode |
## "after head" insertion mode |
| 2454 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 2455 |
if ($token->{tag_name} eq 'body') { |
if ($token->{tag_name} eq 'body') { |
| 2456 |
!!!cp ('t126'); |
!!!cp ('t126'); |
| 2457 |
$self->{insertion_mode} = IN_BODY_IM; |
delete $self->{frameset_ok}; |
| 2458 |
} elsif ($token->{tag_name} eq 'frameset') { |
$self->{insertion_mode} = IN_BODY_IM; |
| 2459 |
!!!cp ('t127'); |
} elsif ($token->{tag_name} eq 'frameset') { |
| 2460 |
$self->{insertion_mode} = IN_FRAMESET_IM; |
!!!cp ('t127'); |
| 2461 |
} else { |
$self->{insertion_mode} = IN_FRAMESET_IM; |
| 2462 |
die "$0: tag name: $self->{tag_name}"; |
} else { |
| 2463 |
} |
die "$0: tag name: $self->{tag_name}"; |
| 2464 |
!!!nack ('t127.1'); |
} |
| 2465 |
!!!next-token; |
!!!nack ('t127.1'); |
| 2466 |
next B; |
!!!next-token; |
| 2467 |
} else { |
next B; |
| 2468 |
!!!cp ('t128'); |
} else { |
| 2469 |
# |
!!!cp ('t128'); |
| 2470 |
} |
# |
| 2471 |
|
} |
| 2472 |
|
|
| 2473 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 2474 |
!!!cp ('t129'); |
!!!cp ('t129'); |
| 2492 |
!!!cp ('t131'); |
!!!cp ('t131'); |
| 2493 |
} |
} |
| 2494 |
|
|
| 2495 |
## "after head" insertion mode |
## "after head" insertion mode |
| 2496 |
## As if <body> |
## As if <body> |
| 2497 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 2498 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 2499 |
## reprocess |
## The "frameset-ok" flag is not changed in this case. |
| 2500 |
!!!ack-later; |
## Reprocess the token. |
| 2501 |
next B; |
!!!ack-later; |
| 2502 |
|
next B; |
| 2503 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 2504 |
## "Before head", "in head", and "after head" insertion modes |
## "Before head", "in head", and "after head" insertion modes |
| 2505 |
## ignore most of end tags. Exceptions are "body", "html", |
## ignore most of end tags. Exceptions are "body", "html", |
| 2594 |
## As if <body> |
## As if <body> |
| 2595 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 2596 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 2597 |
## Reprocess. |
## The "frameset-ok" flag is left unchanged in this case. |
| 2598 |
|
## Reprocess the token. |
| 2599 |
next B; |
next B; |
| 2600 |
} |
} |
| 2601 |
|
|
| 2658 |
## NOTE: As if <body> |
## NOTE: As if <body> |
| 2659 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 2660 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 2661 |
## NOTE: Reprocess. |
## The "frameset-ok" flag is left unchanged in this case. |
| 2662 |
|
## Reprocess the token. |
| 2663 |
next B; |
next B; |
| 2664 |
} else { |
} else { |
| 2665 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 2666 |
} |
} |
| 2667 |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
| 2668 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 2669 |
!!!cp ('t150'); |
!!!cp ('t150'); |
| 2670 |
## NOTE: There is a code clone of "character in body". |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 2671 |
$reconstruct_active_formatting_elements->($insert_to_current); |
|
| 2672 |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
|
| 2673 |
|
|
| 2674 |
!!!next-token; |
if ($token->{data} =~ /[^\x09\x0A\x0C\x0D\x20]/) { |
| 2675 |
next B; |
delete $self->{frameset_ok}; |
| 2676 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} |
| 2677 |
|
|
| 2678 |
|
!!!next-token; |
| 2679 |
|
next B; |
| 2680 |
|
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 2681 |
if ({ |
if ({ |
| 2682 |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
| 2683 |
td => 1, tfoot => 1, th => 1, thead => 1, tr => 1, |
td => 1, tfoot => 1, th => 1, thead => 1, tr => 1, |
| 4460 |
} else { |
} else { |
| 4461 |
!!!cp ('t348'); |
!!!cp ('t348'); |
| 4462 |
} |
} |
| 4463 |
|
|
| 4464 |
|
delete $self->{frameset_ok}; |
| 4465 |
} elsif ($token->{tag_name} eq 'form') { |
} elsif ($token->{tag_name} eq 'form') { |
| 4466 |
!!!cp ('t347.1'); |
!!!cp ('t347.1'); |
| 4467 |
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
| 4471 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
| 4472 |
!!!cp ('t382'); |
!!!cp ('t382'); |
| 4473 |
push @{$open_tables}, [$self->{open_elements}->[-1]->[0]]; |
push @{$open_tables}, [$self->{open_elements}->[-1]->[0]]; |
| 4474 |
|
|
| 4475 |
|
delete $self->{frameset_ok}; |
| 4476 |
|
|
| 4477 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 4478 |
|
|
| 4481 |
} elsif ($token->{tag_name} eq 'hr') { |
} elsif ($token->{tag_name} eq 'hr') { |
| 4482 |
!!!cp ('t386'); |
!!!cp ('t386'); |
| 4483 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4484 |
|
|
| 4485 |
!!!ack ('t386.1'); |
!!!ack ('t386.1'); |
| 4486 |
|
|
| 4487 |
|
delete $self->{frameset_ok}; |
| 4488 |
|
|
| 4489 |
!!!next-token; |
!!!next-token; |
| 4490 |
} else { |
} else { |
| 4491 |
!!!nack ('t347.1'); |
!!!nack ('t347.1'); |
| 4508 |
## Interpreted as <li><foo><li/></foo></li> (non-conforming): |
## Interpreted as <li><foo><li/></foo></li> (non-conforming): |
| 4509 |
## div (Fx, S) |
## div (Fx, S) |
| 4510 |
|
|
| 4511 |
|
## 1. Frameset-ng |
| 4512 |
|
delete $self->{frameset_ok}; |
| 4513 |
|
|
| 4514 |
my $non_optional; |
my $non_optional; |
| 4515 |
my $i = -1; |
my $i = -1; |
| 4516 |
|
|
| 4517 |
## 1. |
## 2. |
| 4518 |
for my $node (reverse @{$self->{open_elements}}) { |
for my $node (reverse @{$self->{open_elements}}) { |
| 4519 |
if ($node->[1] == LI_EL) { |
if ($node->[1] == LI_EL) { |
| 4520 |
## 2. (a) As if </li> |
## 3. (a) As if </li> |
| 4521 |
{ |
{ |
| 4522 |
## If no </li> - not applied |
## If no </li> - not applied |
| 4523 |
# |
# |
| 4541 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
| 4542 |
} |
} |
| 4543 |
|
|
| 4544 |
last; ## 2. (b) goto 5. |
last; ## 3. (b) goto 5. |
| 4545 |
} elsif ( |
} elsif ( |
| 4546 |
## NOTE: not "formatting" and not "phrasing" |
## NOTE: not "formatting" and not "phrasing" |
| 4547 |
($node->[1] & SPECIAL_EL or |
($node->[1] & SPECIAL_EL or |
| 4549 |
## NOTE: "li", "dt", and "dd" are in |SPECIAL_EL|. |
## NOTE: "li", "dt", and "dd" are in |SPECIAL_EL|. |
| 4550 |
(not $node->[1] & ADDRESS_DIV_P_EL) |
(not $node->[1] & ADDRESS_DIV_P_EL) |
| 4551 |
) { |
) { |
| 4552 |
## 3. |
## 4. |
| 4553 |
!!!cp ('t357'); |
!!!cp ('t357'); |
| 4554 |
last; ## goto 5. |
last; ## goto 6. |
| 4555 |
} elsif ($node->[1] & END_TAG_OPTIONAL_EL) { |
} elsif ($node->[1] & END_TAG_OPTIONAL_EL) { |
| 4556 |
!!!cp ('t358'); |
!!!cp ('t358'); |
| 4557 |
# |
# |
| 4560 |
$non_optional ||= $node; |
$non_optional ||= $node; |
| 4561 |
# |
# |
| 4562 |
} |
} |
| 4563 |
## 4. |
## 5. |
| 4564 |
## goto 2. |
## goto 3. |
| 4565 |
$i--; |
$i--; |
| 4566 |
} |
} |
| 4567 |
|
|
| 4568 |
## 5. (a) has a |p| element in scope |
## 6. (a) has a |p| element in scope |
| 4569 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 4570 |
if ($_->[1] == P_EL) { |
if ($_->[1] == P_EL) { |
| 4571 |
!!!cp ('t353'); |
!!!cp ('t353'); |
| 4582 |
} |
} |
| 4583 |
} # INSCOPE |
} # INSCOPE |
| 4584 |
|
|
| 4585 |
## 5. (b) insert |
## 6. (b) insert |
| 4586 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 4587 |
!!!nack ('t359.1'); |
!!!nack ('t359.1'); |
| 4588 |
!!!next-token; |
!!!next-token; |
| 4591 |
$token->{tag_name} eq 'dd') { |
$token->{tag_name} eq 'dd') { |
| 4592 |
## NOTE: As normal, but imply </dt> or </dd> when ... |
## NOTE: As normal, but imply </dt> or </dd> when ... |
| 4593 |
|
|
| 4594 |
|
## 1. Frameset-ng |
| 4595 |
|
delete $self->{frameset_ok}; |
| 4596 |
|
|
| 4597 |
my $non_optional; |
my $non_optional; |
| 4598 |
my $i = -1; |
my $i = -1; |
| 4599 |
|
|
| 4600 |
## 1. |
## 2. |
| 4601 |
for my $node (reverse @{$self->{open_elements}}) { |
for my $node (reverse @{$self->{open_elements}}) { |
| 4602 |
if ($node->[1] == DTDD_EL) { |
if ($node->[1] == DTDD_EL) { |
| 4603 |
## 2. (a) As if </li> |
## 3. (a) As if </li> |
| 4604 |
{ |
{ |
| 4605 |
## If no </li> - not applied |
## If no </li> - not applied |
| 4606 |
# |
# |
| 4624 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
| 4625 |
} |
} |
| 4626 |
|
|
| 4627 |
last; ## 2. (b) goto 5. |
last; ## 3. (b) goto 5. |
| 4628 |
} elsif ( |
} elsif ( |
| 4629 |
## NOTE: not "formatting" and not "phrasing" |
## NOTE: not "formatting" and not "phrasing" |
| 4630 |
($node->[1] & SPECIAL_EL or |
($node->[1] & SPECIAL_EL or |
| 4633 |
|
|
| 4634 |
(not $node->[1] & ADDRESS_DIV_P_EL) |
(not $node->[1] & ADDRESS_DIV_P_EL) |
| 4635 |
) { |
) { |
| 4636 |
## 3. |
## 4. |
| 4637 |
!!!cp ('t357.1'); |
!!!cp ('t357.1'); |
| 4638 |
last; ## goto 5. |
last; ## goto 5. |
| 4639 |
} elsif ($node->[1] & END_TAG_OPTIONAL_EL) { |
} elsif ($node->[1] & END_TAG_OPTIONAL_EL) { |
| 4644 |
$non_optional ||= $node; |
$non_optional ||= $node; |
| 4645 |
# |
# |
| 4646 |
} |
} |
| 4647 |
## 4. |
## 5. |
| 4648 |
## goto 2. |
## goto 3. |
| 4649 |
$i--; |
$i--; |
| 4650 |
} |
} |
| 4651 |
|
|
| 4652 |
## 5. (a) has a |p| element in scope |
## 6. (a) has a |p| element in scope |
| 4653 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 4654 |
if ($_->[1] == P_EL) { |
if ($_->[1] == P_EL) { |
| 4655 |
!!!cp ('t353.1'); |
!!!cp ('t353.1'); |
| 4663 |
} |
} |
| 4664 |
} # INSCOPE |
} # INSCOPE |
| 4665 |
|
|
| 4666 |
## 5. (b) insert |
## 6. (b) insert |
| 4667 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 4668 |
!!!nack ('t359.2'); |
!!!nack ('t359.2'); |
| 4669 |
!!!next-token; |
!!!next-token; |
| 4783 |
|
|
| 4784 |
push @$active_formatting_elements, ['#marker', '']; |
push @$active_formatting_elements, ['#marker', '']; |
| 4785 |
|
|
| 4786 |
|
delete $self->{frameset_ok}; |
| 4787 |
|
|
| 4788 |
!!!nack ('t379.1'); |
!!!nack ('t379.1'); |
| 4789 |
!!!next-token; |
!!!next-token; |
| 4790 |
next B; |
next B; |
| 4798 |
if ($token->{tag_name} eq 'xmp') { |
if ($token->{tag_name} eq 'xmp') { |
| 4799 |
!!!cp ('t381'); |
!!!cp ('t381'); |
| 4800 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 4801 |
|
|
| 4802 |
|
delete $self->{frameset_ok}; |
| 4803 |
|
} elsif ($token->{tag_name} eq 'iframe') { |
| 4804 |
|
!!!cp ('t381.1'); |
| 4805 |
|
delete $self->{frameset_ok}; |
| 4806 |
} else { |
} else { |
| 4807 |
!!!cp ('t399'); |
!!!cp ('t399'); |
| 4808 |
} |
} |
| 4881 |
## 4., 6. Insertion mode |
## 4., 6. Insertion mode |
| 4882 |
$self->{insertion_mode} |= IN_CDATA_RCDATA_IM; |
$self->{insertion_mode} |= IN_CDATA_RCDATA_IM; |
| 4883 |
|
|
| 4884 |
## XXX: 5. frameset-ok flag |
## 5. Frameset-ng. |
| 4885 |
|
delete $self->{frameset_ok}; |
| 4886 |
|
|
| 4887 |
!!!nack ('t392.1'); |
!!!nack ('t392.1'); |
| 4888 |
!!!next-token; |
!!!next-token; |
| 5011 |
applet => 1, marquee => 1, object => 1, |
applet => 1, marquee => 1, object => 1, |
| 5012 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5013 |
!!!cp ('t380'); |
!!!cp ('t380'); |
| 5014 |
|
|
| 5015 |
push @$active_formatting_elements, ['#marker', '']; |
push @$active_formatting_elements, ['#marker', '']; |
| 5016 |
|
|
| 5017 |
|
delete $self->{frameset_ok}; |
| 5018 |
|
|
| 5019 |
!!!nack ('t380.1'); |
!!!nack ('t380.1'); |
| 5020 |
} elsif ({ |
} elsif ({ |
| 5021 |
b => 1, big => 1, em => 1, font => 1, i => 1, |
b => 1, big => 1, em => 1, font => 1, i => 1, |
| 5036 |
keygen => 1, |
keygen => 1, |
| 5037 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5038 |
!!!cp ('t388.1'); |
!!!cp ('t388.1'); |
| 5039 |
|
|
| 5040 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5041 |
|
|
| 5042 |
|
delete $self->{frameset_ok}; |
| 5043 |
|
|
| 5044 |
!!!ack ('t388.3'); |
!!!ack ('t388.3'); |
| 5045 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
| 5046 |
## TODO: associate with $self->{form_element} if defined |
## TODO: associate with $self->{form_element} if defined |
| 5047 |
|
|
| 5048 |
|
delete $self->{frameset_ok}; |
| 5049 |
|
|
| 5050 |
if ($self->{insertion_mode} & TABLE_IMS or |
if ($self->{insertion_mode} & TABLE_IMS or |
| 5051 |
$self->{insertion_mode} & BODY_TABLE_IMS or |
$self->{insertion_mode} & BODY_TABLE_IMS or |
| 5052 |
($self->{insertion_mode} & IM_MASK) == IN_COLUMN_GROUP_IM) { |
($self->{insertion_mode} & IM_MASK) == IN_COLUMN_GROUP_IM) { |