| 18 |
input => 1, |
input => 1, |
| 19 |
}; |
}; |
| 20 |
|
|
|
my $entity_char = { |
|
|
AElig => "\x{00C6}", |
|
|
Aacute => "\x{00C1}", |
|
|
Acirc => "\x{00C2}", |
|
|
Agrave => "\x{00C0}", |
|
|
Alpha => "\x{0391}", |
|
|
Aring => "\x{00C5}", |
|
|
Atilde => "\x{00C3}", |
|
|
Auml => "\x{00C4}", |
|
|
Beta => "\x{0392}", |
|
|
Ccedil => "\x{00C7}", |
|
|
Chi => "\x{03A7}", |
|
|
Dagger => "\x{2021}", |
|
|
Delta => "\x{0394}", |
|
|
ETH => "\x{00D0}", |
|
|
Eacute => "\x{00C9}", |
|
|
Ecirc => "\x{00CA}", |
|
|
Egrave => "\x{00C8}", |
|
|
Epsilon => "\x{0395}", |
|
|
Eta => "\x{0397}", |
|
|
Euml => "\x{00CB}", |
|
|
Gamma => "\x{0393}", |
|
|
Iacute => "\x{00CD}", |
|
|
Icirc => "\x{00CE}", |
|
|
Igrave => "\x{00CC}", |
|
|
Iota => "\x{0399}", |
|
|
Iuml => "\x{00CF}", |
|
|
Kappa => "\x{039A}", |
|
|
Lambda => "\x{039B}", |
|
|
Mu => "\x{039C}", |
|
|
Ntilde => "\x{00D1}", |
|
|
Nu => "\x{039D}", |
|
|
OElig => "\x{0152}", |
|
|
Oacute => "\x{00D3}", |
|
|
Ocirc => "\x{00D4}", |
|
|
Ograve => "\x{00D2}", |
|
|
Omega => "\x{03A9}", |
|
|
Omicron => "\x{039F}", |
|
|
Oslash => "\x{00D8}", |
|
|
Otilde => "\x{00D5}", |
|
|
Ouml => "\x{00D6}", |
|
|
Phi => "\x{03A6}", |
|
|
Pi => "\x{03A0}", |
|
|
Prime => "\x{2033}", |
|
|
Psi => "\x{03A8}", |
|
|
Rho => "\x{03A1}", |
|
|
Scaron => "\x{0160}", |
|
|
Sigma => "\x{03A3}", |
|
|
THORN => "\x{00DE}", |
|
|
Tau => "\x{03A4}", |
|
|
Theta => "\x{0398}", |
|
|
Uacute => "\x{00DA}", |
|
|
Ucirc => "\x{00DB}", |
|
|
Ugrave => "\x{00D9}", |
|
|
Upsilon => "\x{03A5}", |
|
|
Uuml => "\x{00DC}", |
|
|
Xi => "\x{039E}", |
|
|
Yacute => "\x{00DD}", |
|
|
Yuml => "\x{0178}", |
|
|
Zeta => "\x{0396}", |
|
|
aacute => "\x{00E1}", |
|
|
acirc => "\x{00E2}", |
|
|
acute => "\x{00B4}", |
|
|
aelig => "\x{00E6}", |
|
|
agrave => "\x{00E0}", |
|
|
alefsym => "\x{2135}", |
|
|
alpha => "\x{03B1}", |
|
|
amp => "\x{0026}", |
|
|
AMP => "\x{0026}", |
|
|
and => "\x{2227}", |
|
|
ang => "\x{2220}", |
|
|
apos => "\x{0027}", |
|
|
aring => "\x{00E5}", |
|
|
asymp => "\x{2248}", |
|
|
atilde => "\x{00E3}", |
|
|
auml => "\x{00E4}", |
|
|
bdquo => "\x{201E}", |
|
|
beta => "\x{03B2}", |
|
|
brvbar => "\x{00A6}", |
|
|
bull => "\x{2022}", |
|
|
cap => "\x{2229}", |
|
|
ccedil => "\x{00E7}", |
|
|
cedil => "\x{00B8}", |
|
|
cent => "\x{00A2}", |
|
|
chi => "\x{03C7}", |
|
|
circ => "\x{02C6}", |
|
|
clubs => "\x{2663}", |
|
|
cong => "\x{2245}", |
|
|
copy => "\x{00A9}", |
|
|
COPY => "\x{00A9}", |
|
|
crarr => "\x{21B5}", |
|
|
cup => "\x{222A}", |
|
|
curren => "\x{00A4}", |
|
|
dArr => "\x{21D3}", |
|
|
dagger => "\x{2020}", |
|
|
darr => "\x{2193}", |
|
|
deg => "\x{00B0}", |
|
|
delta => "\x{03B4}", |
|
|
diams => "\x{2666}", |
|
|
divide => "\x{00F7}", |
|
|
eacute => "\x{00E9}", |
|
|
ecirc => "\x{00EA}", |
|
|
egrave => "\x{00E8}", |
|
|
empty => "\x{2205}", |
|
|
emsp => "\x{2003}", |
|
|
ensp => "\x{2002}", |
|
|
epsilon => "\x{03B5}", |
|
|
equiv => "\x{2261}", |
|
|
eta => "\x{03B7}", |
|
|
eth => "\x{00F0}", |
|
|
euml => "\x{00EB}", |
|
|
euro => "\x{20AC}", |
|
|
exist => "\x{2203}", |
|
|
fnof => "\x{0192}", |
|
|
forall => "\x{2200}", |
|
|
frac12 => "\x{00BD}", |
|
|
frac14 => "\x{00BC}", |
|
|
frac34 => "\x{00BE}", |
|
|
frasl => "\x{2044}", |
|
|
gamma => "\x{03B3}", |
|
|
ge => "\x{2265}", |
|
|
gt => "\x{003E}", |
|
|
GT => "\x{003E}", |
|
|
hArr => "\x{21D4}", |
|
|
harr => "\x{2194}", |
|
|
hearts => "\x{2665}", |
|
|
hellip => "\x{2026}", |
|
|
iacute => "\x{00ED}", |
|
|
icirc => "\x{00EE}", |
|
|
iexcl => "\x{00A1}", |
|
|
igrave => "\x{00EC}", |
|
|
image => "\x{2111}", |
|
|
infin => "\x{221E}", |
|
|
int => "\x{222B}", |
|
|
iota => "\x{03B9}", |
|
|
iquest => "\x{00BF}", |
|
|
isin => "\x{2208}", |
|
|
iuml => "\x{00EF}", |
|
|
kappa => "\x{03BA}", |
|
|
lArr => "\x{21D0}", |
|
|
lambda => "\x{03BB}", |
|
|
lang => "\x{2329}", |
|
|
laquo => "\x{00AB}", |
|
|
larr => "\x{2190}", |
|
|
lceil => "\x{2308}", |
|
|
ldquo => "\x{201C}", |
|
|
le => "\x{2264}", |
|
|
lfloor => "\x{230A}", |
|
|
lowast => "\x{2217}", |
|
|
loz => "\x{25CA}", |
|
|
lrm => "\x{200E}", |
|
|
lsaquo => "\x{2039}", |
|
|
lsquo => "\x{2018}", |
|
|
lt => "\x{003C}", |
|
|
LT => "\x{003C}", |
|
|
macr => "\x{00AF}", |
|
|
mdash => "\x{2014}", |
|
|
micro => "\x{00B5}", |
|
|
middot => "\x{00B7}", |
|
|
minus => "\x{2212}", |
|
|
mu => "\x{03BC}", |
|
|
nabla => "\x{2207}", |
|
|
nbsp => "\x{00A0}", |
|
|
ndash => "\x{2013}", |
|
|
ne => "\x{2260}", |
|
|
ni => "\x{220B}", |
|
|
not => "\x{00AC}", |
|
|
notin => "\x{2209}", |
|
|
nsub => "\x{2284}", |
|
|
ntilde => "\x{00F1}", |
|
|
nu => "\x{03BD}", |
|
|
oacute => "\x{00F3}", |
|
|
ocirc => "\x{00F4}", |
|
|
oelig => "\x{0153}", |
|
|
ograve => "\x{00F2}", |
|
|
oline => "\x{203E}", |
|
|
omega => "\x{03C9}", |
|
|
omicron => "\x{03BF}", |
|
|
oplus => "\x{2295}", |
|
|
or => "\x{2228}", |
|
|
ordf => "\x{00AA}", |
|
|
ordm => "\x{00BA}", |
|
|
oslash => "\x{00F8}", |
|
|
otilde => "\x{00F5}", |
|
|
otimes => "\x{2297}", |
|
|
ouml => "\x{00F6}", |
|
|
para => "\x{00B6}", |
|
|
part => "\x{2202}", |
|
|
permil => "\x{2030}", |
|
|
perp => "\x{22A5}", |
|
|
phi => "\x{03C6}", |
|
|
pi => "\x{03C0}", |
|
|
piv => "\x{03D6}", |
|
|
plusmn => "\x{00B1}", |
|
|
pound => "\x{00A3}", |
|
|
prime => "\x{2032}", |
|
|
prod => "\x{220F}", |
|
|
prop => "\x{221D}", |
|
|
psi => "\x{03C8}", |
|
|
quot => "\x{0022}", |
|
|
QUOT => "\x{0022}", |
|
|
rArr => "\x{21D2}", |
|
|
radic => "\x{221A}", |
|
|
rang => "\x{232A}", |
|
|
raquo => "\x{00BB}", |
|
|
rarr => "\x{2192}", |
|
|
rceil => "\x{2309}", |
|
|
rdquo => "\x{201D}", |
|
|
real => "\x{211C}", |
|
|
reg => "\x{00AE}", |
|
|
REG => "\x{00AE}", |
|
|
rfloor => "\x{230B}", |
|
|
rho => "\x{03C1}", |
|
|
rlm => "\x{200F}", |
|
|
rsaquo => "\x{203A}", |
|
|
rsquo => "\x{2019}", |
|
|
sbquo => "\x{201A}", |
|
|
scaron => "\x{0161}", |
|
|
sdot => "\x{22C5}", |
|
|
sect => "\x{00A7}", |
|
|
shy => "\x{00AD}", |
|
|
sigma => "\x{03C3}", |
|
|
sigmaf => "\x{03C2}", |
|
|
sim => "\x{223C}", |
|
|
spades => "\x{2660}", |
|
|
sub => "\x{2282}", |
|
|
sube => "\x{2286}", |
|
|
sum => "\x{2211}", |
|
|
sup => "\x{2283}", |
|
|
sup1 => "\x{00B9}", |
|
|
sup2 => "\x{00B2}", |
|
|
sup3 => "\x{00B3}", |
|
|
supe => "\x{2287}", |
|
|
szlig => "\x{00DF}", |
|
|
tau => "\x{03C4}", |
|
|
there4 => "\x{2234}", |
|
|
theta => "\x{03B8}", |
|
|
thetasym => "\x{03D1}", |
|
|
thinsp => "\x{2009}", |
|
|
thorn => "\x{00FE}", |
|
|
tilde => "\x{02DC}", |
|
|
times => "\x{00D7}", |
|
|
trade => "\x{2122}", |
|
|
uArr => "\x{21D1}", |
|
|
uacute => "\x{00FA}", |
|
|
uarr => "\x{2191}", |
|
|
ucirc => "\x{00FB}", |
|
|
ugrave => "\x{00F9}", |
|
|
uml => "\x{00A8}", |
|
|
upsih => "\x{03D2}", |
|
|
upsilon => "\x{03C5}", |
|
|
uuml => "\x{00FC}", |
|
|
weierp => "\x{2118}", |
|
|
xi => "\x{03BE}", |
|
|
yacute => "\x{00FD}", |
|
|
yen => "\x{00A5}", |
|
|
yuml => "\x{00FF}", |
|
|
zeta => "\x{03B6}", |
|
|
zwj => "\x{200D}", |
|
|
zwnj => "\x{200C}", |
|
|
}; # $entity_char |
|
|
|
|
| 21 |
my $c1_entity_char = { |
my $c1_entity_char = { |
| 22 |
0x80 => 0x20AC, |
0x80 => 0x20AC, |
| 23 |
0x81 => 0xFFFD, |
0x81 => 0xFFFD, |
| 87 |
my $column = 0; |
my $column = 0; |
| 88 |
$self->{set_next_input_character} = sub { |
$self->{set_next_input_character} = sub { |
| 89 |
my $self = shift; |
my $self = shift; |
| 90 |
|
|
| 91 |
|
pop @{$self->{prev_input_character}}; |
| 92 |
|
unshift @{$self->{prev_input_character}}, $self->{next_input_character}; |
| 93 |
|
|
| 94 |
$self->{next_input_character} = -1 and return if $i >= length $$s; |
$self->{next_input_character} = -1 and return if $i >= length $$s; |
| 95 |
$self->{next_input_character} = ord substr $$s, $i++, 1; |
$self->{next_input_character} = ord substr $$s, $i++, 1; |
| 96 |
$column++; |
$column++; |
| 99 |
$line++; |
$line++; |
| 100 |
$column = 0; |
$column = 0; |
| 101 |
} elsif ($self->{next_input_character} == 0x000D) { # CR |
} elsif ($self->{next_input_character} == 0x000D) { # CR |
| 102 |
if ($i >= length $$s) { |
$i++ if substr ($$s, $i, 1) eq "\x0A"; |
|
# |
|
|
} else { |
|
|
my $next_char = ord substr $$s, $i++, 1; |
|
|
if ($next_char == 0x000A) { # LF |
|
|
# |
|
|
} else { |
|
|
push @{$self->{char}}, $next_char; |
|
|
} |
|
|
} |
|
| 103 |
$self->{next_input_character} = 0x000A; # LF # MUST |
$self->{next_input_character} = 0x000A; # LF # MUST |
| 104 |
$line++; |
$line++; |
| 105 |
$column = 0; |
$column = 0; |
| 110 |
$self->{next_input_character} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
$self->{next_input_character} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
| 111 |
} |
} |
| 112 |
}; |
}; |
| 113 |
|
$self->{prev_input_character} = [-1, -1, -1]; |
| 114 |
|
$self->{next_input_character} = -1; |
| 115 |
|
|
| 116 |
my $onerror = $_[2] || sub { |
my $onerror = $_[2] || sub { |
| 117 |
my (%opt) = @_; |
my (%opt) = @_; |
| 196 |
} else { |
} else { |
| 197 |
# |
# |
| 198 |
} |
} |
| 199 |
|
} elsif ($self->{next_input_character} == 0x002D) { # - |
| 200 |
|
if ($self->{content_model_flag} eq 'RCDATA' or |
| 201 |
|
$self->{content_model_flag} eq 'CDATA') { |
| 202 |
|
unless ($self->{escape}) { |
| 203 |
|
if ($self->{prev_input_character}->[0] == 0x002D and # - |
| 204 |
|
$self->{prev_input_character}->[1] == 0x0021 and # ! |
| 205 |
|
$self->{prev_input_character}->[2] == 0x003C) { # < |
| 206 |
|
$self->{escape} = 1; |
| 207 |
|
} |
| 208 |
|
} |
| 209 |
|
} |
| 210 |
|
|
| 211 |
|
# |
| 212 |
} elsif ($self->{next_input_character} == 0x003C) { # < |
} elsif ($self->{next_input_character} == 0x003C) { # < |
| 213 |
if ($self->{content_model_flag} ne 'PLAINTEXT') { |
if ($self->{content_model_flag} eq 'PCDATA' or |
| 214 |
|
(($self->{content_model_flag} eq 'CDATA' or |
| 215 |
|
$self->{content_model_flag} eq 'RCDATA') and |
| 216 |
|
not $self->{escape})) { |
| 217 |
$self->{state} = 'tag open'; |
$self->{state} = 'tag open'; |
| 218 |
!!!next-input-character; |
!!!next-input-character; |
| 219 |
redo A; |
redo A; |
| 220 |
} else { |
} else { |
| 221 |
# |
# |
| 222 |
} |
} |
| 223 |
|
} elsif ($self->{next_input_character} == 0x003E) { # > |
| 224 |
|
if ($self->{escape} and |
| 225 |
|
($self->{content_model_flag} eq 'RCDATA' or |
| 226 |
|
$self->{content_model_flag} eq 'CDATA')) { |
| 227 |
|
if ($self->{prev_input_character}->[0] == 0x002D and # - |
| 228 |
|
$self->{prev_input_character}->[1] == 0x002D) { # - |
| 229 |
|
delete $self->{escape}; |
| 230 |
|
} |
| 231 |
|
} |
| 232 |
|
|
| 233 |
|
# |
| 234 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 235 |
!!!emit ({type => 'end-of-file'}); |
!!!emit ({type => 'end-of-file'}); |
| 236 |
last A; ## TODO: ok? |
last A; ## TODO: ok? |
| 1350 |
|
|
| 1351 |
my $value = $entity_name; |
my $value = $entity_name; |
| 1352 |
my $match; |
my $match; |
| 1353 |
|
require Whatpm::_NamedEntityList; |
| 1354 |
|
our $EntityChar; |
| 1355 |
|
|
| 1356 |
while (length $entity_name < 10 and |
while (length $entity_name < 10 and |
| 1357 |
## NOTE: Some number greater than the maximum length of entity name |
## NOTE: Some number greater than the maximum length of entity name |
| 1358 |
((0x0041 <= $self->{next_input_character} and |
((0x0041 <= $self->{next_input_character} and # a |
| 1359 |
$self->{next_input_character} <= 0x005A) or |
$self->{next_input_character} <= 0x005A) or # x |
| 1360 |
(0x0061 <= $self->{next_input_character} and |
(0x0061 <= $self->{next_input_character} and # a |
| 1361 |
$self->{next_input_character} <= 0x007A) or |
$self->{next_input_character} <= 0x007A) or # z |
| 1362 |
(0x0030 <= $self->{next_input_character} and |
(0x0030 <= $self->{next_input_character} and # 0 |
| 1363 |
$self->{next_input_character} <= 0x0039))) { |
$self->{next_input_character} <= 0x0039) or # 9 |
| 1364 |
|
$self->{next_input_character} == 0x003B)) { # ; |
| 1365 |
$entity_name .= chr $self->{next_input_character}; |
$entity_name .= chr $self->{next_input_character}; |
| 1366 |
if (defined $entity_char->{$entity_name}) { |
if (defined $EntityChar->{$entity_name}) { |
| 1367 |
$value = $entity_char->{$entity_name}; |
$value = $EntityChar->{$entity_name}; |
| 1368 |
$match = 1; |
if ($self->{next_input_character} == 0x003B) { # ; |
| 1369 |
|
$match = 1; |
| 1370 |
|
!!!next-input-character; |
| 1371 |
|
last; |
| 1372 |
|
} else { |
| 1373 |
|
$match = -1; |
| 1374 |
|
} |
| 1375 |
} else { |
} else { |
| 1376 |
$value .= chr $self->{next_input_character}; |
$value .= chr $self->{next_input_character}; |
| 1377 |
} |
} |
| 1378 |
!!!next-input-character; |
!!!next-input-character; |
| 1379 |
} |
} |
| 1380 |
|
|
| 1381 |
if ($match) { |
if ($match > 0) { |
| 1382 |
if ($self->{next_input_character} == 0x003B) { # ; |
return {type => 'character', data => $value}; |
| 1383 |
!!!next-input-character; |
} elsif ($match < 0) { |
| 1384 |
} else { |
!!!parse-error (type => 'refc'); |
|
!!!parse-error (type => 'refc'); |
|
|
} |
|
|
|
|
| 1385 |
return {type => 'character', data => $value}; |
return {type => 'character', data => $value}; |
| 1386 |
} else { |
} else { |
| 1387 |
!!!parse-error (type => 'bare ero'); |
!!!parse-error (type => 'bare ero'); |
| 1692 |
? $self->{head_element} : $self->{open_elements}->[-1]->[0]) |
? $self->{head_element} : $self->{open_elements}->[-1]->[0]) |
| 1693 |
->append_child ($style_el); |
->append_child ($style_el); |
| 1694 |
$self->{content_model_flag} = 'CDATA'; |
$self->{content_model_flag} = 'CDATA'; |
| 1695 |
|
delete $self->{escape}; # MUST |
| 1696 |
|
|
| 1697 |
my $text = ''; |
my $text = ''; |
| 1698 |
!!!next-token; |
!!!next-token; |
| 1721 |
## TODO: mark as "parser-inserted" |
## TODO: mark as "parser-inserted" |
| 1722 |
|
|
| 1723 |
$self->{content_model_flag} = 'CDATA'; |
$self->{content_model_flag} = 'CDATA'; |
| 1724 |
|
delete $self->{escape}; # MUST |
| 1725 |
|
|
| 1726 |
my $text = ''; |
my $text = ''; |
| 1727 |
!!!next-token; |
!!!next-token; |
| 2011 |
(defined $self->{head_element} ? $self->{head_element} : $self->{open_elements}->[-1]->[0]) |
(defined $self->{head_element} ? $self->{head_element} : $self->{open_elements}->[-1]->[0]) |
| 2012 |
->append_child ($title_el); |
->append_child ($title_el); |
| 2013 |
$self->{content_model_flag} = 'RCDATA'; |
$self->{content_model_flag} = 'RCDATA'; |
| 2014 |
|
delete $self->{escape}; # MUST |
| 2015 |
|
|
| 2016 |
my $text = ''; |
my $text = ''; |
| 2017 |
!!!next-token; |
!!!next-token; |
| 2358 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
| 2359 |
|
|
| 2360 |
$self->{content_model_flag} = 'CDATA'; |
$self->{content_model_flag} = 'CDATA'; |
| 2361 |
|
delete $self->{escape}; # MUST |
| 2362 |
|
|
| 2363 |
!!!next-token; |
!!!next-token; |
| 2364 |
return; |
return; |
| 2475 |
} else { |
} else { |
| 2476 |
$self->{content_model_flag} = 'CDATA'; |
$self->{content_model_flag} = 'CDATA'; |
| 2477 |
} |
} |
| 2478 |
|
delete $self->{escape}; # MUST |
| 2479 |
|
|
| 2480 |
$insert->($el); |
$insert->($el); |
| 2481 |
|
|
| 2577 |
address => 1, blockquote => 1, center => 1, dir => 1, |
address => 1, blockquote => 1, center => 1, dir => 1, |
| 2578 |
div => 1, dl => 1, fieldset => 1, listing => 1, |
div => 1, dl => 1, fieldset => 1, listing => 1, |
| 2579 |
menu => 1, ol => 1, pre => 1, ul => 1, |
menu => 1, ol => 1, pre => 1, ul => 1, |
|
form => 1, |
|
| 2580 |
p => 1, |
p => 1, |
| 2581 |
dd => 1, dt => 1, li => 1, |
dd => 1, dt => 1, li => 1, |
| 2582 |
button => 1, marquee => 1, object => 1, |
button => 1, marquee => 1, object => 1, |
| 2614 |
} |
} |
| 2615 |
|
|
| 2616 |
splice @{$self->{open_elements}}, $i if defined $i; |
splice @{$self->{open_elements}}, $i if defined $i; |
|
undef $self->{form_element} if $token->{tag_name} eq 'form'; |
|
| 2617 |
$clear_up_to_marker->() |
$clear_up_to_marker->() |
| 2618 |
if { |
if { |
| 2619 |
button => 1, marquee => 1, object => 1, |
button => 1, marquee => 1, object => 1, |
| 2620 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
| 2621 |
!!!next-token; |
!!!next-token; |
| 2622 |
return; |
return; |
| 2623 |
|
} elsif ($token->{tag_name} eq 'form') { |
| 2624 |
|
## has an element in scope |
| 2625 |
|
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 2626 |
|
my $node = $self->{open_elements}->[$_]; |
| 2627 |
|
if ($node->[1] eq $token->{tag_name}) { |
| 2628 |
|
## generate implied end tags |
| 2629 |
|
if ({ |
| 2630 |
|
dd => 1, dt => 1, li => 1, p => 1, |
| 2631 |
|
td => 1, th => 1, tr => 1, |
| 2632 |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
| 2633 |
|
!!!back-token; |
| 2634 |
|
$token = {type => 'end tag', |
| 2635 |
|
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
| 2636 |
|
return; |
| 2637 |
|
} |
| 2638 |
|
last INSCOPE; |
| 2639 |
|
} elsif ({ |
| 2640 |
|
table => 1, caption => 1, td => 1, th => 1, |
| 2641 |
|
button => 1, marquee => 1, object => 1, html => 1, |
| 2642 |
|
}->{$node->[1]}) { |
| 2643 |
|
last INSCOPE; |
| 2644 |
|
} |
| 2645 |
|
} # INSCOPE |
| 2646 |
|
|
| 2647 |
|
if ($self->{open_elements}->[-1]->[1] eq $token->{tag_name}) { |
| 2648 |
|
pop @{$self->{open_elements}}; |
| 2649 |
|
} else { |
| 2650 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
| 2651 |
|
} |
| 2652 |
|
|
| 2653 |
|
undef $self->{form_element}; |
| 2654 |
|
!!!next-token; |
| 2655 |
|
return; |
| 2656 |
} elsif ({ |
} elsif ({ |
| 2657 |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
| 2658 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 2898 |
(defined $self->{head_element} ? $self->{head_element} : $self->{open_elements}->[-1]->[0]) |
(defined $self->{head_element} ? $self->{head_element} : $self->{open_elements}->[-1]->[0]) |
| 2899 |
->append_child ($title_el); |
->append_child ($title_el); |
| 2900 |
$self->{content_model_flag} = 'RCDATA'; |
$self->{content_model_flag} = 'RCDATA'; |
| 2901 |
|
delete $self->{escape}; # MUST |
| 2902 |
|
|
| 2903 |
my $text = ''; |
my $text = ''; |
| 2904 |
!!!next-token; |
!!!next-token; |
| 4670 |
## NOTE: Most of this code is copied from |parse_string| |
## NOTE: Most of this code is copied from |parse_string| |
| 4671 |
|
|
| 4672 |
## Step 1 # MUST |
## Step 1 # MUST |
| 4673 |
my $doc = $node->owner_document->implementation->create_document; |
my $this_doc = $node->owner_document; |
| 4674 |
|
my $doc = $this_doc->implementation->create_document; |
| 4675 |
## TODO: Mark as HTML document |
## TODO: Mark as HTML document |
| 4676 |
my $p = $class->new; |
my $p = $class->new; |
| 4677 |
$p->{document} = $doc; |
$p->{document} = $doc; |
| 4682 |
my $column = 0; |
my $column = 0; |
| 4683 |
$p->{set_next_input_character} = sub { |
$p->{set_next_input_character} = sub { |
| 4684 |
my $self = shift; |
my $self = shift; |
| 4685 |
|
|
| 4686 |
|
pop @{$self->{prev_input_character}}; |
| 4687 |
|
unshift @{$self->{prev_input_character}}, $self->{next_input_character}; |
| 4688 |
|
|
| 4689 |
$self->{next_input_character} = -1 and return if $i >= length $$s; |
$self->{next_input_character} = -1 and return if $i >= length $$s; |
| 4690 |
$self->{next_input_character} = ord substr $$s, $i++, 1; |
$self->{next_input_character} = ord substr $$s, $i++, 1; |
| 4691 |
$column++; |
$column++; |
| 4694 |
$line++; |
$line++; |
| 4695 |
$column = 0; |
$column = 0; |
| 4696 |
} elsif ($self->{next_input_character} == 0x000D) { # CR |
} elsif ($self->{next_input_character} == 0x000D) { # CR |
| 4697 |
if ($i >= length $$s) { |
$i++ if substr ($$s, $i, 1) eq "\x0A"; |
|
# |
|
|
} else { |
|
|
my $next_char = ord substr $$s, $i++, 1; |
|
|
if ($next_char == 0x000A) { # LF |
|
|
# |
|
|
} else { |
|
|
push @{$self->{char}}, $next_char; |
|
|
} |
|
|
} |
|
| 4698 |
$self->{next_input_character} = 0x000A; # LF # MUST |
$self->{next_input_character} = 0x000A; # LF # MUST |
| 4699 |
$line++; |
$line++; |
| 4700 |
$column = 0; |
$column = 0; |
| 4701 |
} elsif ($self->{next_input_character} > 0x10FFFF) { |
} elsif ($self->{next_input_character} > 0x10FFFF) { |
| 4702 |
$self->{next_input_character} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
$self->{next_input_character} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
| 4703 |
} elsif ($self->{next_input_character} == 0x0000) { # NULL |
} elsif ($self->{next_input_character} == 0x0000) { # NULL |
| 4704 |
|
!!!parse-error (type => 'NULL'); |
| 4705 |
$self->{next_input_character} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
$self->{next_input_character} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
| 4706 |
} |
} |
| 4707 |
}; |
}; |
| 4708 |
|
$p->{prev_input_character} = [-1, -1, -1]; |
| 4709 |
|
$p->{next_input_character} = -1; |
| 4710 |
|
|
| 4711 |
my $ponerror = $onerror || sub { |
my $ponerror = $onerror || sub { |
| 4712 |
my (%opt) = @_; |
my (%opt) = @_; |
| 4785 |
## Step 12 # MUST |
## Step 12 # MUST |
| 4786 |
@cn = @{$root->child_nodes}; |
@cn = @{$root->child_nodes}; |
| 4787 |
for (@cn) { |
for (@cn) { |
| 4788 |
|
$this_doc->adopt_node ($_); |
| 4789 |
$node->append_child ($_); |
$node->append_child ($_); |
| 4790 |
} |
} |
| 4791 |
## ISSUE: adopt_node? mutation events? |
## ISSUE: mutation events? |
| 4792 |
|
|
| 4793 |
$p->_terminate_tree_constructor; |
$p->_terminate_tree_constructor; |
| 4794 |
} else { |
} else { |