185 |
wbr => MISC_SPECIAL_EL, |
wbr => MISC_SPECIAL_EL, |
186 |
}; |
}; |
187 |
|
|
|
my $permitted_slash_tag_name = { |
|
|
base => 1, |
|
|
link => 1, |
|
|
meta => 1, |
|
|
hr => 1, |
|
|
br => 1, |
|
|
img => 1, |
|
|
embed => 1, |
|
|
param => 1, |
|
|
area => 1, |
|
|
col => 1, |
|
|
input => 1, |
|
|
}; |
|
|
|
|
188 |
my $c1_entity_char = { |
my $c1_entity_char = { |
189 |
0x80 => 0x20AC, |
0x80 => 0x20AC, |
190 |
0x81 => 0xFFFD, |
0x81 => 0xFFFD, |
432 |
sub AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE () { 31 } |
sub AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE () { 31 } |
433 |
sub BOGUS_DOCTYPE_STATE () { 32 } |
sub BOGUS_DOCTYPE_STATE () { 32 } |
434 |
sub AFTER_ATTRIBUTE_VALUE_QUOTED_STATE () { 33 } |
sub AFTER_ATTRIBUTE_VALUE_QUOTED_STATE () { 33 } |
435 |
|
sub SELF_CLOSING_START_TAG_STATE () { 34 } |
436 |
|
|
437 |
sub DOCTYPE_TOKEN () { 1 } |
sub DOCTYPE_TOKEN () { 1 } |
438 |
sub COMMENT_TOKEN () { 2 } |
sub COMMENT_TOKEN () { 2 } |
486 |
undef $self->{current_attribute}; |
undef $self->{current_attribute}; |
487 |
undef $self->{last_emitted_start_tag_name}; |
undef $self->{last_emitted_start_tag_name}; |
488 |
undef $self->{last_attribute_value_state}; |
undef $self->{last_attribute_value_state}; |
489 |
|
delete $self->{self_closing}; |
490 |
$self->{char} = []; |
$self->{char} = []; |
491 |
# $self->{next_char} |
# $self->{next_char} |
492 |
!!!next-input-character; |
!!!next-input-character; |
507 |
## ->{value} |
## ->{value} |
508 |
## ->{has_reference} == 1 or 0 |
## ->{has_reference} == 1 or 0 |
509 |
## ->{data} (COMMENT_TOKEN, CHARACTER_TOKEN) |
## ->{data} (COMMENT_TOKEN, CHARACTER_TOKEN) |
510 |
|
## NOTE: The "self-closing flag" is hold as |$self->{self_closing}|. |
511 |
|
## |->{self_closing}| is used to save the value of |$self->{self_closing}| |
512 |
|
## while the token is pushed back to the stack. |
513 |
|
|
514 |
|
## ISSUE: "When a DOCTYPE token is created, its |
515 |
|
## <i>self-closing flag</i> must be unset (its other state is that it |
516 |
|
## be set), and its attributes list must be empty.": Wrong subject? |
517 |
|
|
518 |
## Emitted token MUST immediately be handled by the tree construction state. |
## Emitted token MUST immediately be handled by the tree construction state. |
519 |
|
|
540 |
|
|
541 |
sub _get_next_token ($) { |
sub _get_next_token ($) { |
542 |
my $self = shift; |
my $self = shift; |
543 |
|
|
544 |
|
if ($self->{self_closing}) { |
545 |
|
!!!parse-error (type => 'nestc', token => $self->{current_token}); |
546 |
|
## NOTE: The |self_closing| flag is only set by start tag token. |
547 |
|
## In addition, when a start tag token is emitted, it is always set to |
548 |
|
## |current_token|. |
549 |
|
delete $self->{self_closing}; |
550 |
|
} |
551 |
|
|
552 |
if (@{$self->{token}}) { |
if (@{$self->{token}}) { |
553 |
|
$self->{self_closing} = $self->{token}->[0]->{self_closing}; |
554 |
return shift @{$self->{token}}; |
return shift @{$self->{token}}; |
555 |
} |
} |
556 |
|
|
921 |
|
|
922 |
redo A; |
redo A; |
923 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
924 |
|
!!!cp (42); |
925 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
926 |
!!!next-input-character; |
!!!next-input-character; |
|
if ($self->{next_char} == 0x003E and # > |
|
|
$self->{current_token}->{type} == START_TAG_TOKEN and |
|
|
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
|
|
# permitted slash |
|
|
!!!cp (42); |
|
|
# |
|
|
} else { |
|
|
!!!cp (43); |
|
|
!!!parse-error (type => 'nestc'); |
|
|
} |
|
|
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
|
|
# next-input-character is already done |
|
927 |
redo A; |
redo A; |
928 |
} else { |
} else { |
929 |
!!!cp (44); |
!!!cp (44); |
975 |
!!!next-input-character; |
!!!next-input-character; |
976 |
redo A; |
redo A; |
977 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
978 |
|
!!!cp (50); |
979 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
980 |
!!!next-input-character; |
!!!next-input-character; |
|
if ($self->{next_char} == 0x003E and # > |
|
|
$self->{current_token}->{type} == START_TAG_TOKEN and |
|
|
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
|
|
# permitted slash |
|
|
!!!cp (50); |
|
|
# |
|
|
} else { |
|
|
!!!cp (51); |
|
|
!!!parse-error (type => 'nestc'); |
|
|
} |
|
|
## Stay in the state |
|
|
# next-input-character is already done |
|
981 |
redo A; |
redo A; |
982 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
983 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
1078 |
!!!next-input-character; |
!!!next-input-character; |
1079 |
redo A; |
redo A; |
1080 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
1081 |
|
!!!cp (64); |
1082 |
$before_leave->(); |
$before_leave->(); |
1083 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
1084 |
!!!next-input-character; |
!!!next-input-character; |
|
if ($self->{next_char} == 0x003E and # > |
|
|
$self->{current_token}->{type} == START_TAG_TOKEN and |
|
|
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
|
|
# permitted slash |
|
|
!!!cp (64); |
|
|
# |
|
|
} else { |
|
|
!!!cp (65); |
|
|
!!!parse-error (type => 'nestc'); |
|
|
} |
|
|
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
|
|
# next-input-character is already done |
|
1085 |
redo A; |
redo A; |
1086 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1087 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
1168 |
!!!next-input-character; |
!!!next-input-character; |
1169 |
redo A; |
redo A; |
1170 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
1171 |
|
!!!cp (77); |
1172 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
1173 |
!!!next-input-character; |
!!!next-input-character; |
|
if ($self->{next_char} == 0x003E and # > |
|
|
$self->{current_token}->{type} == START_TAG_TOKEN and |
|
|
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
|
|
# permitted slash |
|
|
!!!cp (77); |
|
|
# |
|
|
} else { |
|
|
!!!cp (78); |
|
|
!!!parse-error (type => 'nestc'); |
|
|
## TODO: Different error type for <aa / bb> than <aa/> |
|
|
} |
|
|
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
|
|
# next-input-character is already done |
|
1174 |
redo A; |
redo A; |
1175 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1176 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
1503 |
|
|
1504 |
redo A; |
redo A; |
1505 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
1506 |
|
!!!cp (122); |
1507 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
1508 |
!!!next-input-character; |
!!!next-input-character; |
|
if ($self->{next_char} == 0x003E and # > |
|
|
$self->{current_token}->{type} == START_TAG_TOKEN and |
|
|
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
|
|
# permitted slash |
|
|
!!!cp (122); |
|
|
# |
|
|
} else { |
|
|
!!!cp (123); |
|
|
!!!parse-error (type => 'nestc'); |
|
|
} |
|
|
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
|
|
# next-input-character is already done |
|
1509 |
redo A; |
redo A; |
1510 |
} else { |
} else { |
1511 |
!!!cp (124); |
!!!cp ('124.1'); |
1512 |
!!!parse-error (type => 'no space between attributes'); |
!!!parse-error (type => 'no space between attributes'); |
1513 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
1514 |
## reconsume |
## reconsume |
1515 |
redo A; |
redo A; |
1516 |
} |
} |
1517 |
|
} elsif ($self->{state} == SELF_CLOSING_START_TAG_STATE) { |
1518 |
|
if ($self->{next_char} == 0x003E) { # > |
1519 |
|
if ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1520 |
|
!!!cp ('124.2'); |
1521 |
|
!!!parse-error (type => 'nestc', token => $self->{current_token}); |
1522 |
|
## TODO: Different type than slash in start tag |
1523 |
|
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1524 |
|
if ($self->{current_token}->{attributes}) { |
1525 |
|
!!!cp ('124.4'); |
1526 |
|
!!!parse-error (type => 'end tag attribute'); |
1527 |
|
} else { |
1528 |
|
!!!cp ('124.5'); |
1529 |
|
} |
1530 |
|
## TODO: Test |<title></title/>| |
1531 |
|
} else { |
1532 |
|
!!!cp ('124.3'); |
1533 |
|
$self->{self_closing} = 1; |
1534 |
|
} |
1535 |
|
|
1536 |
|
$self->{state} = DATA_STATE; |
1537 |
|
!!!next-input-character; |
1538 |
|
|
1539 |
|
!!!emit ($self->{current_token}); # start tag or end tag |
1540 |
|
|
1541 |
|
redo A; |
1542 |
|
} else { |
1543 |
|
!!!cp ('124.4'); |
1544 |
|
!!!parse-error (type => 'nestc'); |
1545 |
|
## TODO: This error type is wrong. |
1546 |
|
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
1547 |
|
## Reconsume. |
1548 |
|
redo A; |
1549 |
|
} |
1550 |
} elsif ($self->{state} == BOGUS_COMMENT_STATE) { |
} elsif ($self->{state} == BOGUS_COMMENT_STATE) { |
1551 |
## (only happen if PCDATA state) |
## (only happen if PCDATA state) |
1552 |
|
|
2808 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
2809 |
## Go to the "before html" insertion mode. |
## Go to the "before html" insertion mode. |
2810 |
## reprocess |
## reprocess |
2811 |
|
!!!ack-later; |
2812 |
return; |
return; |
2813 |
} elsif ($token->{type} == CHARACTER_TOKEN) { |
} elsif ($token->{type} == CHARACTER_TOKEN) { |
2814 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { # \x0D |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { # \x0D |
2907 |
$self->{application_cache_selection}->(undef); |
$self->{application_cache_selection}->(undef); |
2908 |
} |
} |
2909 |
|
|
2910 |
|
!!!nack ('t25c'); |
2911 |
|
|
2912 |
!!!next-token; |
!!!next-token; |
2913 |
return; ## Go to the "before head" insertion mode. |
return; ## Go to the "before head" insertion mode. |
2914 |
} else { |
} else { |
2932 |
$self->{application_cache_selection}->(undef); |
$self->{application_cache_selection}->(undef); |
2933 |
|
|
2934 |
## NOTE: Reprocess the token. |
## NOTE: Reprocess the token. |
2935 |
|
!!!ack-later; |
2936 |
return; ## Go to the "before head" insertion mode. |
return; ## Go to the "before head" insertion mode. |
2937 |
|
|
2938 |
## ISSUE: There is an issue in the spec |
## ISSUE: There is an issue in the spec |
3132 |
|
|
3133 |
## Step 4 |
## Step 4 |
3134 |
my $text = ''; |
my $text = ''; |
3135 |
|
!!!nack ('t40.1'); |
3136 |
!!!next-token; |
!!!next-token; |
3137 |
while ($token->{type} == CHARACTER_TOKEN) { # or until stop tokenizing |
while ($token->{type} == CHARACTER_TOKEN) { # or until stop tokenizing |
3138 |
!!!cp ('t40'); |
!!!cp ('t40'); |
3179 |
delete $self->{escape}; # MUST |
delete $self->{escape}; # MUST |
3180 |
|
|
3181 |
my $text = ''; |
my $text = ''; |
3182 |
|
!!!nack ('t45.1'); |
3183 |
!!!next-token; |
!!!next-token; |
3184 |
while ($token->{type} == CHARACTER_TOKEN) { |
while ($token->{type} == CHARACTER_TOKEN) { |
3185 |
!!!cp ('t45'); |
!!!cp ('t45'); |
3528 |
$token->{attributes}->{$attr_name}->{value}); |
$token->{attributes}->{$attr_name}->{value}); |
3529 |
} |
} |
3530 |
} |
} |
3531 |
|
!!!nack ('t84.1'); |
3532 |
!!!next-token; |
!!!next-token; |
3533 |
redo B; |
redo B; |
3534 |
} elsif ($token->{type} == COMMENT_TOKEN) { |
} elsif ($token->{type} == COMMENT_TOKEN) { |
3612 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
3613 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
3614 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3615 |
|
!!!nack ('t93.1'); |
3616 |
!!!next-token; |
!!!next-token; |
3617 |
redo B; |
redo B; |
3618 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3619 |
!!!cp ('t94'); |
!!!cp ('t94'); |
3620 |
# |
# |
3621 |
} else { |
} else { |
3622 |
!!!cp ('t95'); |
!!!cp ('t95'); |
3623 |
!!!parse-error (type => 'in head:head', token => $token); # or in head noscript |
!!!parse-error (type => 'in head:head', token => $token); # or in head noscript |
3624 |
## Ignore the token |
## Ignore the token |
3625 |
!!!next-token; |
!!!nack ('t95.1'); |
3626 |
redo B; |
!!!next-token; |
3627 |
} |
redo B; |
3628 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} |
3629 |
|
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3630 |
!!!cp ('t96'); |
!!!cp ('t96'); |
3631 |
## As if <head> |
## As if <head> |
3632 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, 'head',, $token); |
3666 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
3667 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
3668 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3669 |
|
!!!nack ('t101.1'); |
3670 |
!!!next-token; |
!!!next-token; |
3671 |
redo B; |
redo B; |
3672 |
} elsif ($token->{tag_name} eq 'link') { |
} elsif ($token->{tag_name} eq 'link') { |
3683 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
3684 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
3685 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3686 |
|
!!!ack ('t103.1'); |
3687 |
!!!next-token; |
!!!next-token; |
3688 |
redo B; |
redo B; |
3689 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
3748 |
|
|
3749 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
3750 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3751 |
|
!!!ack ('t110.1'); |
3752 |
!!!next-token; |
!!!next-token; |
3753 |
redo B; |
redo B; |
3754 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
3798 |
## NOTE: and scripting is disalbed |
## NOTE: and scripting is disalbed |
3799 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
3800 |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
3801 |
|
!!!nack ('t116.1'); |
3802 |
!!!next-token; |
!!!next-token; |
3803 |
redo B; |
redo B; |
3804 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3805 |
!!!cp ('t117'); |
!!!cp ('t117'); |
3806 |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
3807 |
## Ignore the token |
## Ignore the token |
3808 |
|
!!!nack ('t117.1'); |
3809 |
!!!next-token; |
!!!next-token; |
3810 |
redo B; |
redo B; |
3811 |
} else { |
} else { |
3868 |
} else { |
} else { |
3869 |
die "$0: tag name: $self->{tag_name}"; |
die "$0: tag name: $self->{tag_name}"; |
3870 |
} |
} |
3871 |
|
!!!nack ('t127.1'); |
3872 |
!!!next-token; |
!!!next-token; |
3873 |
redo B; |
redo B; |
3874 |
} else { |
} else { |
3902 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
3903 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
3904 |
## reprocess |
## reprocess |
3905 |
|
!!!ack-later; |
3906 |
redo B; |
redo B; |
3907 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
3908 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
4128 |
!!!cp ('t151'); |
!!!cp ('t151'); |
4129 |
|
|
4130 |
## Close the cell |
## Close the cell |
4131 |
!!!back-token; # <?> |
!!!back-token; # <x> |
4132 |
$token = {type => END_TAG_TOKEN, |
$token = {type => END_TAG_TOKEN, |
4133 |
tag_name => $node->[0]->manakai_local_name, |
tag_name => $node->[0]->manakai_local_name, |
4134 |
line => $token->{line}, |
line => $token->{line}, |
4145 |
!!!parse-error (type => 'start tag not allowed', |
!!!parse-error (type => 'start tag not allowed', |
4146 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
4147 |
## Ignore the token |
## Ignore the token |
4148 |
|
!!!nack ('t153.1'); |
4149 |
!!!next-token; |
!!!next-token; |
4150 |
redo B; |
redo B; |
4151 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
4171 |
!!!parse-error (type => 'start tag not allowed', |
!!!parse-error (type => 'start tag not allowed', |
4172 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
4173 |
## Ignore the token |
## Ignore the token |
4174 |
|
!!!nack ('t157.1'); |
4175 |
!!!next-token; |
!!!next-token; |
4176 |
redo B; |
redo B; |
4177 |
} # INSCOPE |
} # INSCOPE |
4200 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
4201 |
|
|
4202 |
## reprocess |
## reprocess |
4203 |
|
!!!ack-later; |
4204 |
redo B; |
redo B; |
4205 |
} else { |
} else { |
4206 |
!!!cp ('t161'); |
!!!cp ('t161'); |
4346 |
$i = $_; |
$i = $_; |
4347 |
|
|
4348 |
## Close the cell |
## Close the cell |
4349 |
!!!back-token; # </?> |
!!!back-token; # </x> |
4350 |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
4351 |
line => $token->{line}, |
line => $token->{line}, |
4352 |
column => $token->{column}}; |
column => $token->{column}}; |
4565 |
if ($token->{tag_name} eq 'tr') { |
if ($token->{tag_name} eq 'tr') { |
4566 |
!!!cp ('t204'); |
!!!cp ('t204'); |
4567 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
4568 |
|
!!!nack ('t204'); |
4569 |
!!!next-token; |
!!!next-token; |
4570 |
redo B; |
redo B; |
4571 |
} else { |
} else { |
4589 |
|
|
4590 |
push @$active_formatting_elements, ['#marker', '']; |
push @$active_formatting_elements, ['#marker', '']; |
4591 |
|
|
4592 |
|
!!!nack ('t207.1'); |
4593 |
!!!next-token; |
!!!next-token; |
4594 |
redo B; |
redo B; |
4595 |
} elsif ({ |
} elsif ({ |
4613 |
} |
} |
4614 |
} # INSCOPE |
} # INSCOPE |
4615 |
unless (defined $i) { |
unless (defined $i) { |
4616 |
!!!cp ('t210'); |
!!!cp ('t210'); |
4617 |
## TODO: This type is wrong. |
## TODO: This type is wrong. |
4618 |
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}, token => $token); |
4619 |
## Ignore the token |
## Ignore the token |
4620 |
|
!!!nack ('t210.1'); |
4621 |
!!!next-token; |
!!!next-token; |
4622 |
redo B; |
redo B; |
4623 |
} |
} |
4635 |
if ($token->{tag_name} eq 'tr') { |
if ($token->{tag_name} eq 'tr') { |
4636 |
!!!cp ('t212'); |
!!!cp ('t212'); |
4637 |
## reprocess |
## reprocess |
4638 |
|
!!!ack-later; |
4639 |
redo B; |
redo B; |
4640 |
} else { |
} else { |
4641 |
!!!cp ('t213'); |
!!!cp ('t213'); |
4662 |
## TODO: This erorr type ios wrong. |
## TODO: This erorr type ios wrong. |
4663 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4664 |
## Ignore the token |
## Ignore the token |
4665 |
|
!!!nack ('t216.1'); |
4666 |
!!!next-token; |
!!!next-token; |
4667 |
redo B; |
redo B; |
4668 |
} |
} |
4701 |
!!!insert-element ('colgroup',, $token); |
!!!insert-element ('colgroup',, $token); |
4702 |
$self->{insertion_mode} = IN_COLUMN_GROUP_IM; |
$self->{insertion_mode} = IN_COLUMN_GROUP_IM; |
4703 |
## reprocess |
## reprocess |
4704 |
|
!!!ack-later; |
4705 |
redo B; |
redo B; |
4706 |
} elsif ({ |
} elsif ({ |
4707 |
caption => 1, |
caption => 1, |
4728 |
thead => IN_TABLE_BODY_IM, |
thead => IN_TABLE_BODY_IM, |
4729 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
4730 |
!!!next-token; |
!!!next-token; |
4731 |
|
!!!nack ('t220.1'); |
4732 |
redo B; |
redo B; |
4733 |
} else { |
} else { |
4734 |
die "$0: in table: <>: $token->{tag_name}"; |
die "$0: in table: <>: $token->{tag_name}"; |
4758 |
## TODO: The following is wrong, maybe. |
## TODO: The following is wrong, maybe. |
4759 |
!!!parse-error (type => 'unmatched end tag:table', token => $token); |
!!!parse-error (type => 'unmatched end tag:table', token => $token); |
4760 |
## Ignore tokens </table><table> |
## Ignore tokens </table><table> |
4761 |
|
!!!nack ('t223.1'); |
4762 |
!!!next-token; |
!!!next-token; |
4763 |
redo B; |
redo B; |
4764 |
} |
} |
4786 |
|
|
4787 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
4788 |
|
|
4789 |
## reprocess |
## reprocess |
4790 |
redo B; |
!!!ack-later; |
4791 |
|
redo B; |
4792 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
4793 |
if (not $open_tables->[-1]->[1]) { # tainted |
if (not $open_tables->[-1]->[1]) { # tainted |
4794 |
!!!cp ('t227.8'); |
!!!cp ('t227.8'); |
4824 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4825 |
|
|
4826 |
!!!next-token; |
!!!next-token; |
4827 |
|
!!!ack ('t227.2.1'); |
4828 |
redo B; |
redo B; |
4829 |
} else { |
} else { |
4830 |
!!!cp ('t227.2'); |
!!!cp ('t227.2'); |
4867 |
!!!cp ('t230'); |
!!!cp ('t230'); |
4868 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4869 |
## Ignore the token |
## Ignore the token |
4870 |
|
!!!nack ('t230.1'); |
4871 |
!!!next-token; |
!!!next-token; |
4872 |
redo B; |
redo B; |
4873 |
} else { |
} else { |
4885 |
pop @{$self->{open_elements}}; # tr |
pop @{$self->{open_elements}}; # tr |
4886 |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
4887 |
!!!next-token; |
!!!next-token; |
4888 |
|
!!!nack ('t231.1'); |
4889 |
redo B; |
redo B; |
4890 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
4891 |
if ($self->{insertion_mode} == IN_ROW_IM) { |
if ($self->{insertion_mode} == IN_ROW_IM) { |
4908 |
## TODO: The following is wrong. |
## TODO: The following is wrong. |
4909 |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}, token => $token); |
4910 |
## Ignore the token |
## Ignore the token |
4911 |
|
!!!nack ('t236.1'); |
4912 |
!!!next-token; |
!!!next-token; |
4913 |
redo B; |
redo B; |
4914 |
} |
} |
4944 |
!!!cp ('t239'); |
!!!cp ('t239'); |
4945 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4946 |
## Ignore the token |
## Ignore the token |
4947 |
|
!!!nack ('t239.1'); |
4948 |
!!!next-token; |
!!!next-token; |
4949 |
redo B; |
redo B; |
4950 |
} |
} |
4990 |
!!!cp ('t243'); |
!!!cp ('t243'); |
4991 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
4992 |
## Ignore the token |
## Ignore the token |
4993 |
|
!!!nack ('t243.1'); |
4994 |
!!!next-token; |
!!!next-token; |
4995 |
redo B; |
redo B; |
4996 |
} |
} |
5024 |
!!!cp ('t249'); |
!!!cp ('t249'); |
5025 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
5026 |
## Ignore the token |
## Ignore the token |
5027 |
|
!!!nack ('t249.1'); |
5028 |
!!!next-token; |
!!!next-token; |
5029 |
redo B; |
redo B; |
5030 |
} |
} |
5047 |
!!!cp ('t252'); |
!!!cp ('t252'); |
5048 |
!!!parse-error (type => 'unmatched end tag:tr', token => $token); |
!!!parse-error (type => 'unmatched end tag:tr', token => $token); |
5049 |
## Ignore the token |
## Ignore the token |
5050 |
|
!!!nack ('t252.1'); |
5051 |
!!!next-token; |
!!!next-token; |
5052 |
redo B; |
redo B; |
5053 |
} |
} |
5082 |
!!!cp ('t256'); |
!!!cp ('t256'); |
5083 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
5084 |
## Ignore the token |
## Ignore the token |
5085 |
|
!!!nack ('t256.1'); |
5086 |
!!!next-token; |
!!!next-token; |
5087 |
redo B; |
redo B; |
5088 |
} |
} |
5097 |
|
|
5098 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5099 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
5100 |
|
!!!nack ('t257.1'); |
5101 |
!!!next-token; |
!!!next-token; |
5102 |
redo B; |
redo B; |
5103 |
} elsif ({ |
} elsif ({ |
5106 |
tr => 1, # $self->{insertion_mode} == IN_ROW_IM |
tr => 1, # $self->{insertion_mode} == IN_ROW_IM |
5107 |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM |
5108 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5109 |
!!!cp ('t258'); |
!!!cp ('t258'); |
5110 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
5111 |
## Ignore the token |
## Ignore the token |
5112 |
!!!next-token; |
!!!nack ('t258.1'); |
5113 |
redo B; |
!!!next-token; |
5114 |
|
redo B; |
5115 |
} else { |
} else { |
5116 |
!!!cp ('t259'); |
!!!cp ('t259'); |
5117 |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
5153 |
!!!cp ('t262'); |
!!!cp ('t262'); |
5154 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5155 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5156 |
|
!!!ack ('t262.1'); |
5157 |
!!!next-token; |
!!!next-token; |
5158 |
redo B; |
redo B; |
5159 |
} else { |
} else { |
5209 |
## TODO: Wrong error type? |
## TODO: Wrong error type? |
5210 |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
5211 |
## Ignore the token |
## Ignore the token |
5212 |
|
!!!nack ('t269.1'); |
5213 |
!!!next-token; |
!!!next-token; |
5214 |
redo B; |
redo B; |
5215 |
} else { |
} else { |
5216 |
!!!cp ('t270'); |
!!!cp ('t270'); |
5217 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
5218 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
5219 |
|
!!!ack-later; |
5220 |
## reprocess |
## reprocess |
5221 |
redo B; |
redo B; |
5222 |
} |
} |
5237 |
} |
} |
5238 |
|
|
5239 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5240 |
|
!!!nack ('t273.1'); |
5241 |
!!!next-token; |
!!!next-token; |
5242 |
redo B; |
redo B; |
5243 |
} elsif ($token->{tag_name} eq 'optgroup') { |
} elsif ($token->{tag_name} eq 'optgroup') { |
5258 |
} |
} |
5259 |
|
|
5260 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5261 |
|
!!!nack ('t277.1'); |
5262 |
!!!next-token; |
!!!next-token; |
5263 |
redo B; |
redo B; |
5264 |
} elsif ($token->{tag_name} eq 'select' or |
} elsif ($token->{tag_name} eq 'select' or |
5290 |
!!!cp ('t280'); |
!!!cp ('t280'); |
5291 |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
5292 |
## Ignore the token |
## Ignore the token |
5293 |
|
!!!nack ('t280.1'); |
5294 |
!!!next-token; |
!!!next-token; |
5295 |
redo B; |
redo B; |
5296 |
} |
} |
5301 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
5302 |
|
|
5303 |
if ($token->{tag_name} eq 'select') { |
if ($token->{tag_name} eq 'select') { |
5304 |
!!!cp ('t281.2'); |
!!!nack ('t281.2'); |
5305 |
!!!next-token; |
!!!next-token; |
5306 |
redo B; |
redo B; |
5307 |
} else { |
} else { |
5308 |
!!!cp ('t281.1'); |
!!!cp ('t281.1'); |
5309 |
|
!!!ack-later; |
5310 |
## Reprocess the token. |
## Reprocess the token. |
5311 |
redo B; |
redo B; |
5312 |
} |
} |
5314 |
!!!cp ('t282'); |
!!!cp ('t282'); |
5315 |
!!!parse-error (type => 'in select:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in select:'.$token->{tag_name}, token => $token); |
5316 |
## Ignore the token |
## Ignore the token |
5317 |
|
!!!nack ('t282.1'); |
5318 |
!!!next-token; |
!!!next-token; |
5319 |
redo B; |
redo B; |
5320 |
} |
} |
5333 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
5334 |
## Ignore the token |
## Ignore the token |
5335 |
} |
} |
5336 |
|
!!!nack ('t285.1'); |
5337 |
!!!next-token; |
!!!next-token; |
5338 |
redo B; |
redo B; |
5339 |
} elsif ($token->{tag_name} eq 'option') { |
} elsif ($token->{tag_name} eq 'option') { |
5345 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
5346 |
## Ignore the token |
## Ignore the token |
5347 |
} |
} |
5348 |
|
!!!nack ('t287.1'); |
5349 |
!!!next-token; |
!!!next-token; |
5350 |
redo B; |
redo B; |
5351 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
5366 |
!!!cp ('t290'); |
!!!cp ('t290'); |
5367 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
5368 |
## Ignore the token |
## Ignore the token |
5369 |
|
!!!nack ('t290.1'); |
5370 |
!!!next-token; |
!!!next-token; |
5371 |
redo B; |
redo B; |
5372 |
} |
} |
5376 |
|
|
5377 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
5378 |
|
|
5379 |
|
!!!nack ('t291.1'); |
5380 |
!!!next-token; |
!!!next-token; |
5381 |
redo B; |
redo B; |
5382 |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
5403 |
unless (defined $i) { |
unless (defined $i) { |
5404 |
!!!cp ('t294'); |
!!!cp ('t294'); |
5405 |
## Ignore the token |
## Ignore the token |
5406 |
|
!!!nack ('t294.1'); |
5407 |
!!!next-token; |
!!!next-token; |
5408 |
redo B; |
redo B; |
5409 |
} |
} |
5428 |
## TODO: The following error type is correct? |
## TODO: The following error type is correct? |
5429 |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
5430 |
## Ignore the </select> token |
## Ignore the </select> token |
5431 |
|
!!!nack ('t297.1'); |
5432 |
!!!next-token; ## TODO: ok? |
!!!next-token; ## TODO: ok? |
5433 |
redo B; |
redo B; |
5434 |
} |
} |
5438 |
|
|
5439 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
5440 |
|
|
5441 |
|
!!!ack-later; |
5442 |
## reprocess |
## reprocess |
5443 |
redo B; |
redo B; |
5444 |
} else { |
} else { |
5445 |
!!!cp ('t299'); |
!!!cp ('t299'); |
5446 |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
5447 |
## Ignore the token |
## Ignore the token |
5448 |
|
!!!nack ('t299.3'); |
5449 |
!!!next-token; |
!!!next-token; |
5450 |
redo B; |
redo B; |
5451 |
} |
} |
5508 |
!!!parse-error (type => 'after body:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after body:'.$token->{tag_name}, token => $token); |
5509 |
|
|
5510 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
5511 |
|
!!!ack-later; |
5512 |
## reprocess |
## reprocess |
5513 |
redo B; |
redo B; |
5514 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
5606 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
5607 |
!!!cp ('t318'); |
!!!cp ('t318'); |
5608 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5609 |
|
!!!nack ('t318.1'); |
5610 |
!!!next-token; |
!!!next-token; |
5611 |
redo B; |
redo B; |
5612 |
} elsif ($token->{tag_name} eq 'frame' and |
} elsif ($token->{tag_name} eq 'frame' and |
5614 |
!!!cp ('t319'); |
!!!cp ('t319'); |
5615 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5616 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5617 |
|
!!!ack ('t319.1'); |
5618 |
!!!next-token; |
!!!next-token; |
5619 |
redo B; |
redo B; |
5620 |
} elsif ($token->{tag_name} eq 'noframes') { |
} elsif ($token->{tag_name} eq 'noframes') { |
5631 |
!!!parse-error (type => 'after frameset:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after frameset:'.$token->{tag_name}, token => $token); |
5632 |
} |
} |
5633 |
## Ignore the token |
## Ignore the token |
5634 |
|
!!!nack ('t322.1'); |
5635 |
!!!next-token; |
!!!next-token; |
5636 |
redo B; |
redo B; |
5637 |
} |
} |
5725 |
## NOTE: This is an "as if in head" code clone, only "-t" differs |
## NOTE: This is an "as if in head" code clone, only "-t" differs |
5726 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
5727 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
5728 |
|
!!!ack ('t334.1'); |
5729 |
!!!next-token; |
!!!next-token; |
5730 |
redo B; |
redo B; |
5731 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
5776 |
} |
} |
5777 |
} |
} |
5778 |
|
|
5779 |
|
!!!ack ('t338.1'); |
5780 |
!!!next-token; |
!!!next-token; |
5781 |
redo B; |
redo B; |
5782 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
5802 |
} |
} |
5803 |
} |
} |
5804 |
} |
} |
5805 |
|
!!!nack ('t343.1'); |
5806 |
!!!next-token; |
!!!next-token; |
5807 |
redo B; |
redo B; |
5808 |
} elsif ({ |
} elsif ({ |
5819 |
!!!cp ('t350'); |
!!!cp ('t350'); |
5820 |
!!!parse-error (type => 'in form:form', token => $token); |
!!!parse-error (type => 'in form:form', token => $token); |
5821 |
## Ignore the token |
## Ignore the token |
5822 |
|
!!!nack ('t350.1'); |
5823 |
!!!next-token; |
!!!next-token; |
5824 |
redo B; |
redo B; |
5825 |
} |
} |
5828 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5829 |
if ($_->[1] & P_EL) { |
if ($_->[1] & P_EL) { |
5830 |
!!!cp ('t344'); |
!!!cp ('t344'); |
5831 |
!!!back-token; |
!!!back-token; # <form> |
5832 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
5833 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
5834 |
redo B; |
redo B; |
5840 |
|
|
5841 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
5842 |
if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') { |
if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') { |
5843 |
|
!!!nack ('t346.1'); |
5844 |
!!!next-token; |
!!!next-token; |
5845 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
5846 |
$token->{data} =~ s/^\x0A//; |
$token->{data} =~ s/^\x0A//; |
5857 |
!!!cp ('t347.1'); |
!!!cp ('t347.1'); |
5858 |
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
5859 |
|
|
5860 |
|
!!!nack ('t347.2'); |
5861 |
!!!next-token; |
!!!next-token; |
5862 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
5863 |
!!!cp ('t382'); |
!!!cp ('t382'); |
5865 |
|
|
5866 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
5867 |
|
|
5868 |
|
!!!nack ('t382.1'); |
5869 |
!!!next-token; |
!!!next-token; |
5870 |
} elsif ($token->{tag_name} eq 'hr') { |
} elsif ($token->{tag_name} eq 'hr') { |
5871 |
!!!cp ('t386'); |
!!!cp ('t386'); |
5872 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5873 |
|
|
5874 |
|
!!!nack ('t386.1'); |
5875 |
!!!next-token; |
!!!next-token; |
5876 |
} else { |
} else { |
5877 |
!!!cp ('t347'); |
!!!nack ('t347.1'); |
5878 |
!!!next-token; |
!!!next-token; |
5879 |
} |
} |
5880 |
redo B; |
redo B; |
5883 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5884 |
if ($_->[1] & P_EL) { |
if ($_->[1] & P_EL) { |
5885 |
!!!cp ('t353'); |
!!!cp ('t353'); |
5886 |
!!!back-token; |
!!!back-token; # <x> |
5887 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
5888 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
5889 |
redo B; |
redo B; |
5936 |
} # LI |
} # LI |
5937 |
|
|
5938 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
5939 |
|
!!!nack ('t359.1'); |
5940 |
!!!next-token; |
!!!next-token; |
5941 |
redo B; |
redo B; |
5942 |
} elsif ($token->{tag_name} eq 'plaintext') { |
} elsif ($token->{tag_name} eq 'plaintext') { |
5944 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5945 |
if ($_->[1] & P_EL) { |
if ($_->[1] & P_EL) { |
5946 |
!!!cp ('t367'); |
!!!cp ('t367'); |
5947 |
!!!back-token; |
!!!back-token; # <plaintext> |
5948 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
5949 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
5950 |
redo B; |
redo B; |
5958 |
|
|
5959 |
$self->{content_model} = PLAINTEXT_CONTENT_MODEL; |
$self->{content_model} = PLAINTEXT_CONTENT_MODEL; |
5960 |
|
|
5961 |
|
!!!nack ('t368.1'); |
5962 |
!!!next-token; |
!!!next-token; |
5963 |
redo B; |
redo B; |
5964 |
} elsif ($token->{tag_name} eq 'a') { |
} elsif ($token->{tag_name} eq 'a') { |
5968 |
!!!cp ('t371'); |
!!!cp ('t371'); |
5969 |
!!!parse-error (type => 'in a:a', token => $token); |
!!!parse-error (type => 'in a:a', token => $token); |
5970 |
|
|
5971 |
!!!back-token; |
!!!back-token; # <a> |
5972 |
$token = {type => END_TAG_TOKEN, tag_name => 'a', |
$token = {type => END_TAG_TOKEN, tag_name => 'a', |
5973 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
5974 |
$formatting_end_tag->($token); |
$formatting_end_tag->($token); |
5999 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
6000 |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
6001 |
|
|
6002 |
|
!!!nack ('t374.1'); |
6003 |
!!!next-token; |
!!!next-token; |
6004 |
redo B; |
redo B; |
6005 |
} elsif ($token->{tag_name} eq 'nobr') { |
} elsif ($token->{tag_name} eq 'nobr') { |
6011 |
if ($node->[1] & NOBR_EL) { |
if ($node->[1] & NOBR_EL) { |
6012 |
!!!cp ('t376'); |
!!!cp ('t376'); |
6013 |
!!!parse-error (type => 'in nobr:nobr', token => $token); |
!!!parse-error (type => 'in nobr:nobr', token => $token); |
6014 |
!!!back-token; |
!!!back-token; # <nobr> |
6015 |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
6016 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
6017 |
redo B; |
redo B; |
6024 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
6025 |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
6026 |
|
|
6027 |
|
!!!nack ('t377.1'); |
6028 |
!!!next-token; |
!!!next-token; |
6029 |
redo B; |
redo B; |
6030 |
} elsif ($token->{tag_name} eq 'button') { |
} elsif ($token->{tag_name} eq 'button') { |
6034 |
if ($node->[1] & BUTTON_EL) { |
if ($node->[1] & BUTTON_EL) { |
6035 |
!!!cp ('t378'); |
!!!cp ('t378'); |
6036 |
!!!parse-error (type => 'in button:button', token => $token); |
!!!parse-error (type => 'in button:button', token => $token); |
6037 |
!!!back-token; |
!!!back-token; # <button> |
6038 |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
6039 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
6040 |
redo B; |
redo B; |
6052 |
|
|
6053 |
push @$active_formatting_elements, ['#marker', '']; |
push @$active_formatting_elements, ['#marker', '']; |
6054 |
|
|
6055 |
|
!!!nack ('t379.1'); |
6056 |
!!!next-token; |
!!!next-token; |
6057 |
redo B; |
redo B; |
6058 |
} elsif ({ |
} elsif ({ |
6077 |
if (defined $self->{form_element}) { |
if (defined $self->{form_element}) { |
6078 |
!!!cp ('t389'); |
!!!cp ('t389'); |
6079 |
## Ignore the token |
## Ignore the token |
6080 |
|
!!!nack ('t389'); ## NOTE: Not acknowledged. |
6081 |
!!!next-token; |
!!!next-token; |
6082 |
redo B; |
redo B; |
6083 |
} else { |
} else { |
6124 |
line => $token->{line}, column => $token->{column}}, |
line => $token->{line}, column => $token->{column}}, |
6125 |
{type => END_TAG_TOKEN, tag_name => 'form', |
{type => END_TAG_TOKEN, tag_name => 'form', |
6126 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
6127 |
$token = shift @tokens; |
!!!nack ('t391.1'); ## NOTE: Not acknowledged. |
6128 |
!!!back-token (@tokens); |
!!!back-token (@tokens); |
6129 |
|
!!!next-token; |
6130 |
redo B; |
redo B; |
6131 |
} |
} |
6132 |
} elsif ($token->{tag_name} eq 'textarea') { |
} elsif ($token->{tag_name} eq 'textarea') { |
6141 |
$insert->($el); |
$insert->($el); |
6142 |
|
|
6143 |
my $text = ''; |
my $text = ''; |
6144 |
|
!!!nack ('t392.1'); |
6145 |
!!!next-token; |
!!!next-token; |
6146 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
6147 |
$token->{data} =~ s/^\x0A//; |
$token->{data} =~ s/^\x0A//; |
6185 |
!!!cp ('t401'); |
!!!cp ('t401'); |
6186 |
!!!parse-error (type => 'in body:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in body:'.$token->{tag_name}, token => $token); |
6187 |
## Ignore the token |
## Ignore the token |
6188 |
|
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
6189 |
!!!next-token; |
!!!next-token; |
6190 |
redo B; |
redo B; |
6191 |
|
|
6209 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6210 |
!!!cp ('t380'); |
!!!cp ('t380'); |
6211 |
push @$active_formatting_elements, ['#marker', '']; |
push @$active_formatting_elements, ['#marker', '']; |
6212 |
|
!!!nack ('t380.1'); |
6213 |
} elsif ({ |
} elsif ({ |
6214 |
b => 1, big => 1, em => 1, font => 1, i => 1, |
b => 1, big => 1, em => 1, font => 1, i => 1, |
6215 |
s => 1, small => 1, strile => 1, |
s => 1, small => 1, strile => 1, |
6217 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6218 |
!!!cp ('t375'); |
!!!cp ('t375'); |
6219 |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
6220 |
|
!!!nack ('t375.1'); |
6221 |
} elsif ($token->{tag_name} eq 'input') { |
} elsif ($token->{tag_name} eq 'input') { |
6222 |
!!!cp ('t388'); |
!!!cp ('t388'); |
6223 |
## TODO: associate with $self->{form_element} if defined |
## TODO: associate with $self->{form_element} if defined |
6224 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6225 |
|
!!!ack ('t388.2'); |
6226 |
} elsif ({ |
} elsif ({ |
6227 |
area => 1, basefont => 1, bgsound => 1, br => 1, |
area => 1, basefont => 1, bgsound => 1, br => 1, |
6228 |
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
6230 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6231 |
!!!cp ('t388.1'); |
!!!cp ('t388.1'); |
6232 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6233 |
|
!!!ack ('t388.3'); |
6234 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
6235 |
## TODO: associate with $self->{form_element} if defined |
## TODO: associate with $self->{form_element} if defined |
6236 |
|
|
6243 |
!!!cp ('t400.2'); |
!!!cp ('t400.2'); |
6244 |
$self->{insertion_mode} = IN_SELECT_IM; |
$self->{insertion_mode} = IN_SELECT_IM; |
6245 |
} |
} |
6246 |
|
!!!nack ('t400.3'); |
6247 |
} else { |
} else { |
6248 |
!!!cp ('t402'); |
!!!nack ('t402'); |
6249 |
} |
} |
6250 |
|
|
6251 |
!!!next-token; |
!!!next-token; |