| 179 |
dt => DTDD_EL, |
dt => DTDD_EL, |
| 180 |
em => FORMATTING_EL, |
em => FORMATTING_EL, |
| 181 |
embed => MISC_SPECIAL_EL, |
embed => MISC_SPECIAL_EL, |
|
eventsource => MISC_SPECIAL_EL, |
|
| 182 |
fieldset => MISC_SPECIAL_EL, |
fieldset => MISC_SPECIAL_EL, |
| 183 |
figure => MISC_SPECIAL_EL, |
figure => MISC_SPECIAL_EL, |
| 184 |
font => FORMATTING_EL, |
font => FORMATTING_EL, |
| 202 |
#image => MISC_SPECIAL_EL, ## NOTE: Commented out in the spec. |
#image => MISC_SPECIAL_EL, ## NOTE: Commented out in the spec. |
| 203 |
input => MISC_SPECIAL_EL, |
input => MISC_SPECIAL_EL, |
| 204 |
isindex => MISC_SPECIAL_EL, |
isindex => MISC_SPECIAL_EL, |
| 205 |
|
## XXX keygen? (Whether a void element is in Special or not does not |
| 206 |
|
## affect to the processing, however.) |
| 207 |
li => LI_EL, |
li => LI_EL, |
| 208 |
link => MISC_SPECIAL_EL, |
link => MISC_SPECIAL_EL, |
| 209 |
listing => MISC_SPECIAL_EL, |
listing => MISC_SPECIAL_EL, |
| 248 |
u => FORMATTING_EL, |
u => FORMATTING_EL, |
| 249 |
ul => MISC_SPECIAL_EL, |
ul => MISC_SPECIAL_EL, |
| 250 |
wbr => MISC_SPECIAL_EL, |
wbr => MISC_SPECIAL_EL, |
| 251 |
|
xmp => MISC_SPECIAL_EL, |
| 252 |
}; |
}; |
| 253 |
|
|
| 254 |
my $el_category_f = { |
my $el_category_f = { |
| 649 |
|
|
| 650 |
## NOTE: |set_inner_html| copies most of this method's code |
## NOTE: |set_inner_html| copies most of this method's code |
| 651 |
|
|
| 652 |
|
## Confidence: irrelevant. |
| 653 |
$self->{confident} = 1 unless exists $self->{confident}; |
$self->{confident} = 1 unless exists $self->{confident}; |
| 654 |
|
|
| 655 |
$self->{document}->input_encoding ($self->{input_encoding}) |
$self->{document}->input_encoding ($self->{input_encoding}) |
| 656 |
if defined $self->{input_encoding}; |
if defined $self->{input_encoding}; |
| 657 |
## TODO: |{input_encoding}| is needless? |
## TODO: |{input_encoding}| is needless? |
| 915 |
|
|
| 916 |
INITIAL: { |
INITIAL: { |
| 917 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
| 918 |
## NOTE: Conformance checkers MAY, instead of reporting "not HTML5" |
## NOTE: Conformance checkers MAY, instead of reporting "not |
| 919 |
## error, switch to a conformance checking mode for another |
## HTML5" error, switch to a conformance checking mode for |
| 920 |
## language. |
## another language. (We don't support such mode switchings; it |
| 921 |
|
## is nonsense to do anything different from what browsers do.) |
| 922 |
my $doctype_name = $token->{name}; |
my $doctype_name = $token->{name}; |
| 923 |
$doctype_name = '' unless defined $doctype_name; |
$doctype_name = '' unless defined $doctype_name; |
| 924 |
$doctype_name =~ tr/a-z/A-Z/; # ASCII case-insensitive |
my $doctype = $self->{document}->create_document_type_definition |
| 925 |
if (not defined $token->{name} or # <!DOCTYPE> |
($doctype_name); |
| 926 |
defined $token->{sysid}) { |
|
| 927 |
|
$doctype_name =~ tr/A-Z/a-z/; # ASCII case-insensitive |
| 928 |
|
if ($doctype_name ne 'html') { |
| 929 |
!!!cp ('t1'); |
!!!cp ('t1'); |
| 930 |
!!!parse-error (type => 'not HTML5', token => $token); |
!!!parse-error (type => 'not HTML5', token => $token); |
| 931 |
} elsif ($doctype_name ne 'HTML') { |
} elsif (defined $token->{pubid}) { |
| 932 |
!!!cp ('t2'); |
!!!cp ('t2'); |
| 933 |
|
## XXX Obsolete permitted DOCTYPEs |
| 934 |
!!!parse-error (type => 'not HTML5', token => $token); |
!!!parse-error (type => 'not HTML5', token => $token); |
| 935 |
} elsif (defined $token->{pubid}) { |
} elsif (defined $token->{sysid}) { |
| 936 |
if ($token->{pubid} eq 'XSLT-compat') { |
if ($token->{sysid} eq 'about:legacy-compat') { |
| 937 |
!!!cp ('t1.2'); |
!!!cp ('t1.2'); ## <!DOCTYPE HTML SYSTEM "about:legacy-compat"> |
| 938 |
!!!parse-error (type => 'XSLT-compat', token => $token, |
!!!parse-error (type => 'XSLT-compat', token => $token, |
| 939 |
level => $self->{level}->{should}); |
level => $self->{level}->{should}); |
| 940 |
} else { |
} else { |
| 941 |
!!!parse-error (type => 'not HTML5', token => $token); |
!!!parse-error (type => 'not HTML5', token => $token); |
| 942 |
} |
} |
| 943 |
} else { |
} else { ## <!DOCTYPE HTML> |
| 944 |
!!!cp ('t3'); |
!!!cp ('t3'); |
| 945 |
# |
# |
| 946 |
} |
} |
| 947 |
|
|
|
my $doctype = $self->{document}->create_document_type_definition |
|
|
($token->{name}); ## ISSUE: If name is missing (e.g. <!DOCTYPE>)? |
|
| 948 |
## NOTE: Default value for both |public_id| and |system_id| attributes |
## NOTE: Default value for both |public_id| and |system_id| attributes |
| 949 |
## are empty strings, so that we don't set any value in missing cases. |
## are empty strings, so that we don't set any value in missing cases. |
| 950 |
$doctype->public_id ($token->{pubid}) if defined $token->{pubid}; |
$doctype->public_id ($token->{pubid}) if defined $token->{pubid}; |
| 951 |
$doctype->system_id ($token->{sysid}) if defined $token->{sysid}; |
$doctype->system_id ($token->{sysid}) if defined $token->{sysid}; |
| 952 |
|
|
| 953 |
## NOTE: Other DocumentType attributes are null or empty lists. |
## NOTE: Other DocumentType attributes are null or empty lists. |
| 954 |
## In Firefox3, |internalSubset| attribute is set to the empty |
## In Firefox3, |internalSubset| attribute is set to the empty |
| 955 |
## string, while |null| is an allowed value for the attribute |
## string, while |null| is an allowed value for the attribute |
| 956 |
## according to DOM3 Core. |
## according to DOM3 Core. |
| 957 |
$self->{document}->append_child ($doctype); |
$self->{document}->append_child ($doctype); |
| 958 |
|
|
| 959 |
if ($token->{quirks} or $doctype_name ne 'HTML') { |
if ($token->{quirks} or $doctype_name ne 'html') { |
| 960 |
!!!cp ('t4'); |
!!!cp ('t4'); |
| 961 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
| 962 |
} elsif (defined $token->{pubid}) { |
} elsif (defined $token->{pubid}) { |
| 1442 |
}; # $script_start_tag |
}; # $script_start_tag |
| 1443 |
|
|
| 1444 |
## NOTE: $open_tables->[-1]->[0] is the "current table" element node. |
## NOTE: $open_tables->[-1]->[0] is the "current table" element node. |
| 1445 |
## NOTE: $open_tables->[-1]->[1] is the "tainted" flag. |
## NOTE: $open_tables->[-1]->[1] is the "tainted" flag (OBSOLETE; unused). |
| 1446 |
## NOTE: $open_tables->[-1]->[2] is set false when non-Text node inserted. |
## NOTE: $open_tables->[-1]->[2] is set false when non-Text node inserted. |
| 1447 |
my $open_tables = [[$self->{open_elements}->[0]->[0]]]; |
my $open_tables = [[$self->{open_elements}->[0]->[0]]]; |
| 1448 |
|
|
| 1612 |
|
|
| 1613 |
## Step 8 |
## Step 8 |
| 1614 |
if ($common_ancestor_node->[1] & TABLE_ROWS_EL) { |
if ($common_ancestor_node->[1] & TABLE_ROWS_EL) { |
| 1615 |
|
## Foster parenting. |
| 1616 |
my $foster_parent_element; |
my $foster_parent_element; |
| 1617 |
my $next_sibling; |
my $next_sibling; |
| 1618 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
| 1619 |
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
| 1620 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
!!!cp ('t65.2'); |
| 1621 |
if (defined $parent and $parent->node_type == 1) { |
$foster_parent_element = $self->{open_elements}->[$_ - 1]->[0]; |
| 1622 |
!!!cp ('t65.1'); |
$next_sibling = $self->{open_elements}->[$_]->[0]; |
| 1623 |
$foster_parent_element = $parent; |
undef $next_sibling |
| 1624 |
$next_sibling = $self->{open_elements}->[$_]->[0]; |
unless $next_sibling->parent_node eq $foster_parent_element; |
| 1625 |
} else { |
last OE; |
| 1626 |
!!!cp ('t65.2'); |
} |
| 1627 |
$foster_parent_element |
} # OE |
| 1628 |
= $self->{open_elements}->[$_ - 1]->[0]; |
$foster_parent_element ||= $self->{open_elements}->[0]->[0]; |
| 1629 |
} |
|
|
last OE; |
|
|
} |
|
|
} # OE |
|
|
$foster_parent_element = $self->{open_elements}->[0]->[0] |
|
|
unless defined $foster_parent_element; |
|
| 1630 |
$foster_parent_element->insert_before ($last_node->[0], $next_sibling); |
$foster_parent_element->insert_before ($last_node->[0], $next_sibling); |
| 1631 |
$open_tables->[-1]->[1] = 1; # tainted |
$open_tables->[-1]->[1] = 1; # tainted |
| 1632 |
} else { |
} else { |
| 1682 |
$self->{open_elements}->[-1]->[0]->append_child ($_[0]); |
$self->{open_elements}->[-1]->[0]->append_child ($_[0]); |
| 1683 |
}; # $insert_to_current |
}; # $insert_to_current |
| 1684 |
|
|
| 1685 |
|
## Foster parenting. Note that there are three "foster parenting" |
| 1686 |
|
## code in the parser: for elements (this one), for texts, and for |
| 1687 |
|
## elements in the AAA code. |
| 1688 |
my $insert_to_foster = sub { |
my $insert_to_foster = sub { |
| 1689 |
my $child = shift; |
my $child = shift; |
| 1690 |
if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) { |
if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) { |
| 1693 |
my $next_sibling; |
my $next_sibling; |
| 1694 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
| 1695 |
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
| 1696 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
!!!cp ('t71'); |
| 1697 |
if (defined $parent and $parent->node_type == 1) { |
$foster_parent_element = $self->{open_elements}->[$_ - 1]->[0]; |
| 1698 |
!!!cp ('t70'); |
$next_sibling = $self->{open_elements}->[$_]->[0]; |
| 1699 |
$foster_parent_element = $parent; |
undef $next_sibling |
| 1700 |
$next_sibling = $self->{open_elements}->[$_]->[0]; |
unless $next_sibling->parent_node eq $foster_parent_element; |
| 1701 |
} else { |
last OE; |
| 1702 |
!!!cp ('t71'); |
} |
| 1703 |
$foster_parent_element |
} # OE |
| 1704 |
= $self->{open_elements}->[$_ - 1]->[0]; |
$foster_parent_element ||= $self->{open_elements}->[0]->[0]; |
| 1705 |
} |
|
| 1706 |
last OE; |
$foster_parent_element->insert_before ($child, $next_sibling); |
|
} |
|
|
} # OE |
|
|
$foster_parent_element = $self->{open_elements}->[0]->[0] |
|
|
unless defined $foster_parent_element; |
|
|
$foster_parent_element->insert_before |
|
|
($child, $next_sibling); |
|
| 1707 |
$open_tables->[-1]->[1] = 1; # tainted |
$open_tables->[-1]->[1] = 1; # tainted |
| 1708 |
} else { |
} else { |
| 1709 |
!!!cp ('t72'); |
!!!cp ('t72'); |
| 1731 |
## document.write ("b")</script>| |
## document.write ("b")</script>| |
| 1732 |
|
|
| 1733 |
B: while (1) { |
B: while (1) { |
| 1734 |
|
|
| 1735 |
|
## The "in table text" insertion mode. |
| 1736 |
|
if ($self->{insertion_mode} & TABLE_IMS and |
| 1737 |
|
not $self->{insertion_mode} & IN_FOREIGN_CONTENT_IM and |
| 1738 |
|
not $self->{insertion_mode} & IN_CDATA_RCDATA_IM) { |
| 1739 |
|
C: { |
| 1740 |
|
my $s; |
| 1741 |
|
if ($token->{type} == CHARACTER_TOKEN) { |
| 1742 |
|
!!!cp ('t194'); |
| 1743 |
|
$self->{pending_chars} ||= []; |
| 1744 |
|
push @{$self->{pending_chars}}, $token; |
| 1745 |
|
!!!next-token; |
| 1746 |
|
next B; |
| 1747 |
|
} else { |
| 1748 |
|
if ($self->{pending_chars}) { |
| 1749 |
|
$s = join '', map { $_->{data} } @{$self->{pending_chars}}; |
| 1750 |
|
delete $self->{pending_chars}; |
| 1751 |
|
if ($s =~ /[^\x09\x0A\x0C\x0D\x20]/) { |
| 1752 |
|
!!!cp ('t195'); |
| 1753 |
|
# |
| 1754 |
|
} else { |
| 1755 |
|
!!!cp ('t195.1'); |
| 1756 |
|
#$self->{open_elements}->[-1]->[0]->manakai_append_text ($s); |
| 1757 |
|
$self->{open_elements}->[-1]->[0]->append_child |
| 1758 |
|
($self->{document}->create_text_node ($s)); |
| 1759 |
|
last C; |
| 1760 |
|
} |
| 1761 |
|
} else { |
| 1762 |
|
!!!cp ('t195.2'); |
| 1763 |
|
last C; |
| 1764 |
|
} |
| 1765 |
|
} |
| 1766 |
|
|
| 1767 |
|
## Foster parenting. |
| 1768 |
|
!!!parse-error (type => 'in table:#text', token => $token); |
| 1769 |
|
|
| 1770 |
|
## NOTE: As if in body, but insert into the foster parent element. |
| 1771 |
|
$reconstruct_active_formatting_elements->($insert_to_foster); |
| 1772 |
|
|
| 1773 |
|
if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) { |
| 1774 |
|
# MUST |
| 1775 |
|
my $foster_parent_element; |
| 1776 |
|
my $next_sibling; |
| 1777 |
|
OE: for (reverse 0..$#{$self->{open_elements}}) { |
| 1778 |
|
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
| 1779 |
|
!!!cp ('t197'); |
| 1780 |
|
$foster_parent_element = $self->{open_elements}->[$_ - 1]->[0]; |
| 1781 |
|
$next_sibling = $self->{open_elements}->[$_]->[0]; |
| 1782 |
|
undef $next_sibling |
| 1783 |
|
unless $next_sibling->parent_node eq $foster_parent_element; |
| 1784 |
|
last OE; |
| 1785 |
|
} |
| 1786 |
|
} # OE |
| 1787 |
|
$foster_parent_element ||= $self->{open_elements}->[0]->[0]; |
| 1788 |
|
|
| 1789 |
|
!!!cp ('t199'); |
| 1790 |
|
$foster_parent_element->insert_before |
| 1791 |
|
($self->{document}->create_text_node ($s), $next_sibling); |
| 1792 |
|
|
| 1793 |
|
$open_tables->[-1]->[1] = 1; # tainted |
| 1794 |
|
$open_tables->[-1]->[2] = 1; # ~node inserted |
| 1795 |
|
} else { |
| 1796 |
|
## NOTE: Fragment case or in a foster parent'ed element |
| 1797 |
|
## (e.g. |<table><span>a|). In fragment case, whether the |
| 1798 |
|
## character is appended to existing node or a new node is |
| 1799 |
|
## created is irrelevant, since the foster parent'ed nodes |
| 1800 |
|
## are discarded and fragment parsing does not invoke any |
| 1801 |
|
## script. |
| 1802 |
|
!!!cp ('t200'); |
| 1803 |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($s); |
| 1804 |
|
} |
| 1805 |
|
} # C |
| 1806 |
|
} # TABLE_IMS |
| 1807 |
|
|
| 1808 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
| 1809 |
!!!cp ('t73'); |
!!!cp ('t73'); |
| 1810 |
!!!parse-error (type => 'in html:#DOCTYPE', token => $token); |
!!!parse-error (type => 'in html:#DOCTYPE', token => $token); |
| 2223 |
!!!ack ('t103.1'); |
!!!ack ('t103.1'); |
| 2224 |
!!!next-token; |
!!!next-token; |
| 2225 |
next B; |
next B; |
| 2226 |
} elsif ($token->{tag_name} eq 'command' or |
} elsif ($token->{tag_name} eq 'command') { |
|
$token->{tag_name} eq 'eventsource') { |
|
| 2227 |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
| 2228 |
## NOTE: If the insertion mode at the time of the emission |
## NOTE: If the insertion mode at the time of the emission |
| 2229 |
## of the token was "before head", $self->{insertion_mode} |
## of the token was "before head", $self->{insertion_mode} |
| 3091 |
$insert = $insert_to_current; |
$insert = $insert_to_current; |
| 3092 |
# |
# |
| 3093 |
} elsif ($self->{insertion_mode} & TABLE_IMS) { |
} elsif ($self->{insertion_mode} & TABLE_IMS) { |
| 3094 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == START_TAG_TOKEN) { |
|
if (not $open_tables->[-1]->[1] and # tainted |
|
|
$token->{data} =~ s/^([\x09\x0A\x0C\x20]+)//) { |
|
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
|
|
|
|
|
unless (length $token->{data}) { |
|
|
!!!cp ('t194'); |
|
|
!!!next-token; |
|
|
next B; |
|
|
} else { |
|
|
!!!cp ('t195'); |
|
|
} |
|
|
} |
|
|
|
|
|
!!!parse-error (type => 'in table:#text', token => $token); |
|
|
|
|
|
## NOTE: As if in body, but insert into the foster parent element. |
|
|
$reconstruct_active_formatting_elements->($insert_to_foster); |
|
|
|
|
|
if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) { |
|
|
# MUST |
|
|
my $foster_parent_element; |
|
|
my $next_sibling; |
|
|
my $prev_sibling; |
|
|
OE: for (reverse 0..$#{$self->{open_elements}}) { |
|
|
if ($self->{open_elements}->[$_]->[1] == TABLE_EL) { |
|
|
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
|
|
if (defined $parent and $parent->node_type == 1) { |
|
|
$foster_parent_element = $parent; |
|
|
!!!cp ('t196'); |
|
|
$next_sibling = $self->{open_elements}->[$_]->[0]; |
|
|
$prev_sibling = $next_sibling->previous_sibling; |
|
|
# |
|
|
} else { |
|
|
!!!cp ('t197'); |
|
|
$foster_parent_element = $self->{open_elements}->[$_ - 1]->[0]; |
|
|
$prev_sibling = $foster_parent_element->last_child; |
|
|
# |
|
|
} |
|
|
last OE; |
|
|
} |
|
|
} # OE |
|
|
$foster_parent_element = $self->{open_elements}->[0]->[0] and |
|
|
$prev_sibling = $foster_parent_element->last_child |
|
|
unless defined $foster_parent_element; |
|
|
undef $prev_sibling unless $open_tables->[-1]->[2]; # ~node inserted |
|
|
if (defined $prev_sibling and |
|
|
$prev_sibling->node_type == 3) { |
|
|
!!!cp ('t198'); |
|
|
$prev_sibling->manakai_append_text ($token->{data}); |
|
|
} else { |
|
|
!!!cp ('t199'); |
|
|
$foster_parent_element->insert_before |
|
|
($self->{document}->create_text_node ($token->{data}), |
|
|
$next_sibling); |
|
|
} |
|
|
$open_tables->[-1]->[1] = 1; # tainted |
|
|
$open_tables->[-1]->[2] = 1; # ~node inserted |
|
|
} else { |
|
|
## NOTE: Fragment case or in a foster parent'ed element |
|
|
## (e.g. |<table><span>a|). In fragment case, whether the |
|
|
## character is appended to existing node or a new node is |
|
|
## created is irrelevant, since the foster parent'ed nodes |
|
|
## are discarded and fragment parsing does not invoke any |
|
|
## script. |
|
|
!!!cp ('t200'); |
|
|
$self->{open_elements}->[-1]->[0]->manakai_append_text |
|
|
($token->{data}); |
|
|
} |
|
|
|
|
|
!!!next-token; |
|
|
next B; |
|
|
} elsif ($token->{type} == START_TAG_TOKEN) { |
|
| 3095 |
if ({ |
if ({ |
| 3096 |
tr => (($self->{insertion_mode} & IM_MASK) != IN_ROW_IM), |
tr => (($self->{insertion_mode} & IM_MASK) != IN_ROW_IM), |
| 3097 |
th => 1, td => 1, |
th => 1, td => 1, |
| 3359 |
!!!ack-later; |
!!!ack-later; |
| 3360 |
next B; |
next B; |
| 3361 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
| 3362 |
if (not $open_tables->[-1]->[1]) { # tainted |
!!!cp ('t227.8'); |
| 3363 |
!!!cp ('t227.8'); |
## NOTE: This is a "as if in head" code clone. |
| 3364 |
## NOTE: This is a "as if in head" code clone. |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 3365 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted |
| 3366 |
$open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted |
next B; |
|
next B; |
|
|
} else { |
|
|
!!!cp ('t227.7'); |
|
|
# |
|
|
} |
|
| 3367 |
} elsif ($token->{tag_name} eq 'script') { |
} elsif ($token->{tag_name} eq 'script') { |
| 3368 |
if (not $open_tables->[-1]->[1]) { # tainted |
!!!cp ('t227.6'); |
| 3369 |
!!!cp ('t227.6'); |
## NOTE: This is a "as if in head" code clone. |
| 3370 |
## NOTE: This is a "as if in head" code clone. |
$script_start_tag->(); |
| 3371 |
$script_start_tag->(); |
$open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted |
| 3372 |
$open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted |
next B; |
|
next B; |
|
|
} else { |
|
|
!!!cp ('t227.5'); |
|
|
# |
|
|
} |
|
| 3373 |
} elsif ($token->{tag_name} eq 'input') { |
} elsif ($token->{tag_name} eq 'input') { |
| 3374 |
if (not $open_tables->[-1]->[1]) { # tainted |
if ($token->{attributes}->{type}) { |
| 3375 |
if ($token->{attributes}->{type}) { ## TODO: case |
my $type = $token->{attributes}->{type}->{value}; |
| 3376 |
my $type = lc $token->{attributes}->{type}->{value}; |
$type =~ tr/A-Z/a-z/; ## ASCII case-insensitive. |
| 3377 |
if ($type eq 'hidden') { |
if ($type eq 'hidden') { |
| 3378 |
!!!cp ('t227.3'); |
!!!cp ('t227.3'); |
| 3379 |
!!!parse-error (type => 'in table', |
!!!parse-error (type => 'in table', |
| 3380 |
text => $token->{tag_name}, token => $token); |
text => $token->{tag_name}, token => $token); |
| 3381 |
|
|
| 3382 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 3383 |
$open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted |
$open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted |
| 3384 |
|
|
| 3385 |
## TODO: form element pointer |
## TODO: form element pointer |
| 3386 |
|
|
| 3387 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 3388 |
|
|
| 3389 |
!!!next-token; |
!!!next-token; |
| 3390 |
!!!ack ('t227.2.1'); |
!!!ack ('t227.2.1'); |
| 3391 |
next B; |
next B; |
|
} else { |
|
|
!!!cp ('t227.2'); |
|
|
# |
|
|
} |
|
| 3392 |
} else { |
} else { |
| 3393 |
!!!cp ('t227.1'); |
!!!cp ('t227.1'); |
| 3394 |
# |
# |
| 3901 |
## Reprocess the token. |
## Reprocess the token. |
| 3902 |
next B; |
next B; |
| 3903 |
} |
} |
| 3904 |
|
} elsif ($token->{tag_name} eq 'script') { |
| 3905 |
|
!!!cp ('t281.3'); |
| 3906 |
|
## NOTE: This is an "as if in head" code clone |
| 3907 |
|
$script_start_tag->(); |
| 3908 |
|
next B; |
| 3909 |
} else { |
} else { |
| 3910 |
!!!cp ('t282'); |
!!!cp ('t282'); |
| 3911 |
!!!parse-error (type => 'in select', |
!!!parse-error (type => 'in select', |
| 4317 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 4318 |
next B; |
next B; |
| 4319 |
} elsif ({ |
} elsif ({ |
| 4320 |
base => 1, command => 1, eventsource => 1, link => 1, |
base => 1, command => 1, link => 1, |
| 4321 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 4322 |
!!!cp ('t334'); |
!!!cp ('t334'); |
| 4323 |
## 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 |
| 5029 |
} elsif ({ |
} elsif ({ |
| 5030 |
area => 1, basefont => 1, bgsound => 1, br => 1, |
area => 1, basefont => 1, bgsound => 1, br => 1, |
| 5031 |
embed => 1, img => 1, spacer => 1, wbr => 1, |
embed => 1, img => 1, spacer => 1, wbr => 1, |
| 5032 |
|
keygen => 1, |
| 5033 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5034 |
!!!cp ('t388.1'); |
!!!cp ('t388.1'); |
| 5035 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5493 |
my $onerror = $_[1]; |
my $onerror = $_[1]; |
| 5494 |
my $get_wrapper = $_[2] || sub ($) { return $_[0] }; |
my $get_wrapper = $_[2] || sub ($) { return $_[0] }; |
| 5495 |
|
|
|
## ISSUE: Should {confident} be true? |
|
|
|
|
| 5496 |
my $nt = $node->node_type; |
my $nt = $node->node_type; |
| 5497 |
if ($nt == 9) { # Document (invoke the algorithm with no /context/ element) |
if ($nt == 9) { # Document (invoke the algorithm with no /context/ element) |
| 5498 |
# MUST |
# MUST |
| 5707 |
$anode = $anode->parent_node; |
$anode = $anode->parent_node; |
| 5708 |
} # AN |
} # AN |
| 5709 |
|
|
| 5710 |
|
## F.5. Set the input stream. |
| 5711 |
|
$p->{confident} = 1; ## Confident: irrelevant. |
| 5712 |
|
|
| 5713 |
## F.6. Start the parser. |
## F.6. Start the parser. |
| 5714 |
{ |
{ |
| 5715 |
my $self = $p; |
my $self = $p; |