| 488 |
if (defined $charset_name) { |
if (defined $charset_name) { |
| 489 |
$charset = Message::Charset::Info->get_by_html_name ($charset_name); |
$charset = Message::Charset::Info->get_by_html_name ($charset_name); |
| 490 |
|
|
|
## ISSUE: Unsupported encoding is not ignored according to the spec. |
|
| 491 |
require Whatpm::Charset::DecodeHandle; |
require Whatpm::Charset::DecodeHandle; |
| 492 |
$buffer = Whatpm::Charset::DecodeHandle::ByteBuffer->new |
$buffer = Whatpm::Charset::DecodeHandle::ByteBuffer->new |
| 493 |
($byte_stream); |
($byte_stream); |
| 2484 |
!!!cp (160); |
!!!cp (160); |
| 2485 |
$self->{ct}->{name} = chr $self->{nc}; |
$self->{ct}->{name} = chr $self->{nc}; |
| 2486 |
delete $self->{ct}->{quirks}; |
delete $self->{ct}->{quirks}; |
|
## ISSUE: "Set the token's name name to the" in the spec |
|
| 2487 |
$self->{state} = DOCTYPE_NAME_STATE; |
$self->{state} = DOCTYPE_NAME_STATE; |
| 2488 |
!!!next-input-character; |
!!!next-input-character; |
| 2489 |
redo A; |
redo A; |
| 3783 |
## NOTE: Reprocess the token. |
## NOTE: Reprocess the token. |
| 3784 |
!!!ack-later; |
!!!ack-later; |
| 3785 |
return; ## Go to the "before head" insertion mode. |
return; ## Go to the "before head" insertion mode. |
|
|
|
|
## ISSUE: There is an issue in the spec |
|
| 3786 |
} # B |
} # B |
| 3787 |
|
|
| 3788 |
die "$0: _tree_construction_root_element: This should never be reached"; |
die "$0: _tree_construction_root_element: This should never be reached"; |
| 4711 |
!!!cp ('t105'); |
!!!cp ('t105'); |
| 4712 |
} |
} |
| 4713 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 4714 |
my $meta_el = pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
my $meta_el = pop @{$self->{open_elements}}; |
| 4715 |
|
|
| 4716 |
unless ($self->{confident}) { |
unless ($self->{confident}) { |
| 4717 |
if ($token->{attributes}->{charset}) { |
if ($token->{attributes}->{charset}) { |
| 5168 |
} else { |
} else { |
| 5169 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 5170 |
} |
} |
|
|
|
|
## ISSUE: An issue in the spec. |
|
| 5171 |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
| 5172 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 5173 |
!!!cp ('t150'); |
!!!cp ('t150'); |
| 6795 |
} else { |
} else { |
| 6796 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 6797 |
} |
} |
|
|
|
|
## ISSUE: An issue in spec here |
|
| 6798 |
} else { |
} else { |
| 6799 |
die "$0: $self->{insertion_mode}: Unknown insertion mode"; |
die "$0: $self->{insertion_mode}: Unknown insertion mode"; |
| 6800 |
} |
} |
| 7056 |
} |
} |
| 7057 |
|
|
| 7058 |
## 5. (a) has a |p| element in scope |
## 5. (a) has a |p| element in scope |
|
## ISSUE: Is this step really necessary? |
|
| 7059 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 7060 |
if ($_->[1] & P_EL) { |
if ($_->[1] & P_EL) { |
| 7061 |
!!!cp ('t353'); |
!!!cp ('t353'); |
| 7062 |
|
|
| 7063 |
|
## NOTE: |<p><li>|, for example. |
| 7064 |
|
|
| 7065 |
!!!back-token; # <x> |
!!!back-token; # <x> |
| 7066 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
| 7067 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 7138 |
} |
} |
| 7139 |
|
|
| 7140 |
## 5. (a) has a |p| element in scope |
## 5. (a) has a |p| element in scope |
|
## ISSUE: Is this step really necessary? |
|
| 7141 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 7142 |
if ($_->[1] & P_EL) { |
if ($_->[1] & P_EL) { |
| 7143 |
!!!cp ('t353.1'); |
!!!cp ('t353.1'); |
| 7467 |
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
| 7468 |
!!!next-token; |
!!!next-token; |
| 7469 |
next B; |
next B; |
| 7470 |
|
} elsif ($token->{tag_name} eq 'param' or |
| 7471 |
## ISSUE: An issue on HTML5 new elements in the spec. |
$token->{tag_name} eq 'source') { |
| 7472 |
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 7473 |
|
pop @{$self->{open_elements}}; |
| 7474 |
|
|
| 7475 |
|
!!!ack ('t398.5'); |
| 7476 |
|
!!!next-token; |
| 7477 |
|
redo B; |
| 7478 |
} else { |
} else { |
| 7479 |
if ($token->{tag_name} eq 'image') { |
if ($token->{tag_name} eq 'image') { |
| 7480 |
!!!cp ('t384'); |
!!!cp ('t384'); |
| 7510 |
!!!ack ('t388.2'); |
!!!ack ('t388.2'); |
| 7511 |
} elsif ({ |
} elsif ({ |
| 7512 |
area => 1, basefont => 1, bgsound => 1, br => 1, |
area => 1, basefont => 1, bgsound => 1, br => 1, |
| 7513 |
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
embed => 1, img => 1, spacer => 1, wbr => 1, |
|
#image => 1, |
|
| 7514 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 7515 |
!!!cp ('t388.1'); |
!!!cp ('t388.1'); |
| 7516 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 7578 |
## up-to-date, though it has same effect as speced. |
## up-to-date, though it has same effect as speced. |
| 7579 |
if (@{$self->{open_elements}} > 1 and |
if (@{$self->{open_elements}} > 1 and |
| 7580 |
$self->{open_elements}->[1]->[1] & BODY_EL) { |
$self->{open_elements}->[1]->[1] & BODY_EL) { |
|
## ISSUE: There is an issue in the spec. |
|
| 7581 |
unless ($self->{open_elements}->[-1]->[1] & BODY_EL) { |
unless ($self->{open_elements}->[-1]->[1] & BODY_EL) { |
| 7582 |
!!!cp ('t406'); |
!!!cp ('t406'); |
| 7583 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
| 7613 |
|
|
| 7614 |
applet => 1, button => 1, marquee => 1, object => 1, |
applet => 1, button => 1, marquee => 1, object => 1, |
| 7615 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 7616 |
|
## NOTE: Code for <li> start tags includes "as if </li>" code. |
| 7617 |
|
## Code for <dt> or <dd> start tags includes "as if </dt> or |
| 7618 |
|
## </dd>" code. |
| 7619 |
|
|
| 7620 |
## has an element in scope |
## has an element in scope |
| 7621 |
my $i; |
my $i; |
| 7622 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 7775 |
## NOTE: As normal, except </p> implies <p> and ... |
## NOTE: As normal, except </p> implies <p> and ... |
| 7776 |
|
|
| 7777 |
## has an element in scope |
## has an element in scope |
| 7778 |
|
my $non_optional; |
| 7779 |
my $i; |
my $i; |
| 7780 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 7781 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 7786 |
} elsif ($node->[1] & SCOPING_EL) { |
} elsif ($node->[1] & SCOPING_EL) { |
| 7787 |
!!!cp ('t411.1'); |
!!!cp ('t411.1'); |
| 7788 |
last INSCOPE; |
last INSCOPE; |
| 7789 |
|
} elsif ($node->[1] & END_TAG_OPTIONAL_EL) { |
| 7790 |
|
## NOTE: |END_TAG_OPTIONAL_EL| includes "p" |
| 7791 |
|
!!!cp ('t411.2'); |
| 7792 |
|
# |
| 7793 |
|
} else { |
| 7794 |
|
!!!cp ('t411.3'); |
| 7795 |
|
$non_optional ||= $node; |
| 7796 |
|
# |
| 7797 |
} |
} |
| 7798 |
} # INSCOPE |
} # INSCOPE |
| 7799 |
|
|
| 7800 |
if (defined $i) { |
if (defined $i) { |
| 7801 |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
## 1. Generate implied end tags |
| 7802 |
ne $token->{tag_name}) { |
# |
| 7803 |
|
|
| 7804 |
|
## 2. If current node != "p", parse error |
| 7805 |
|
if ($non_optional) { |
| 7806 |
!!!cp ('t412.1'); |
!!!cp ('t412.1'); |
| 7807 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
| 7808 |
text => $self->{open_elements}->[-1]->[0] |
text => $non_optional->[0]->manakai_local_name, |
|
->manakai_local_name, |
|
| 7809 |
token => $token); |
token => $token); |
| 7810 |
} else { |
} else { |
| 7811 |
!!!cp ('t414.1'); |
!!!cp ('t414.1'); |
| 7812 |
} |
} |
| 7813 |
|
|
| 7814 |
|
## 3. Pop |
| 7815 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
| 7816 |
} else { |
} else { |
| 7817 |
!!!cp ('t413.1'); |
!!!cp ('t413.1'); |