| 12 |
## TODO: 1252 parse error (revision 1264) |
## TODO: 1252 parse error (revision 1264) |
| 13 |
## TODO: 8859-11 = 874 (revision 1271) |
## TODO: 8859-11 = 874 (revision 1271) |
| 14 |
|
|
| 15 |
my $permitted_slash_tag_name = { |
my $HTML_NS = q<http://www.w3.org/1999/xhtml>; |
| 16 |
base => 1, |
my $MML_NS = q<http://www.w3.org/1998/Math/MathML>; |
| 17 |
link => 1, |
my $SVG_NS = q<http://www.w3.org/2000/svg>; |
| 18 |
meta => 1, |
my $XLINK_NS = q<http://www.w3.org/1999/xlink>; |
| 19 |
hr => 1, |
my $XML_NS = q<http://www.w3.org/XML/1998/namespace>; |
| 20 |
br => 1, |
my $XMLNS_NS = q<http://www.w3.org/2000/xmlns/>; |
| 21 |
img => 1, |
|
| 22 |
embed => 1, |
sub A_EL () { 0b1 } |
| 23 |
param => 1, |
sub ADDRESS_EL () { 0b10 } |
| 24 |
area => 1, |
sub BODY_EL () { 0b100 } |
| 25 |
col => 1, |
sub BUTTON_EL () { 0b1000 } |
| 26 |
input => 1, |
sub CAPTION_EL () { 0b10000 } |
| 27 |
|
sub DD_EL () { 0b100000 } |
| 28 |
|
sub DIV_EL () { 0b1000000 } |
| 29 |
|
sub DT_EL () { 0b10000000 } |
| 30 |
|
sub FORM_EL () { 0b100000000 } |
| 31 |
|
sub FORMATTING_EL () { 0b1000000000 } |
| 32 |
|
sub FRAMESET_EL () { 0b10000000000 } |
| 33 |
|
sub HEADING_EL () { 0b100000000000 } |
| 34 |
|
sub HTML_EL () { 0b1000000000000 } |
| 35 |
|
sub LI_EL () { 0b10000000000000 } |
| 36 |
|
sub NOBR_EL () { 0b100000000000000 } |
| 37 |
|
sub OPTION_EL () { 0b1000000000000000 } |
| 38 |
|
sub OPTGROUP_EL () { 0b10000000000000000 } |
| 39 |
|
sub P_EL () { 0b100000000000000000 } |
| 40 |
|
sub SELECT_EL () { 0b1000000000000000000 } |
| 41 |
|
sub TABLE_EL () { 0b10000000000000000000 } |
| 42 |
|
sub TABLE_CELL_EL () { 0b100000000000000000000 } |
| 43 |
|
sub TABLE_ROW_EL () { 0b1000000000000000000000 } |
| 44 |
|
sub TABLE_ROW_GROUP_EL () { 0b10000000000000000000000 } |
| 45 |
|
sub MISC_SCOPING_EL () { 0b100000000000000000000000 } |
| 46 |
|
sub MISC_SPECIAL_EL () { 0b1000000000000000000000000 } |
| 47 |
|
sub FOREIGN_EL () { 0b10000000000000000000000000 } |
| 48 |
|
sub FOREIGN_FLOW_CONTENT_EL () { 0b100000000000000000000000000 } |
| 49 |
|
sub MML_AXML_EL () { 0b1000000000000000000000000000 } |
| 50 |
|
|
| 51 |
|
sub TABLE_ROWS_EL () { |
| 52 |
|
TABLE_EL | |
| 53 |
|
TABLE_ROW_EL | |
| 54 |
|
TABLE_ROW_GROUP_EL |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
sub END_TAG_OPTIONAL_EL () { |
| 58 |
|
DD_EL | |
| 59 |
|
DT_EL | |
| 60 |
|
LI_EL | |
| 61 |
|
P_EL |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
sub ALL_END_TAG_OPTIONAL_EL () { |
| 65 |
|
END_TAG_OPTIONAL_EL | |
| 66 |
|
BODY_EL | |
| 67 |
|
HTML_EL | |
| 68 |
|
TABLE_CELL_EL | |
| 69 |
|
TABLE_ROW_EL | |
| 70 |
|
TABLE_ROW_GROUP_EL |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
sub SCOPING_EL () { |
| 74 |
|
BUTTON_EL | |
| 75 |
|
CAPTION_EL | |
| 76 |
|
HTML_EL | |
| 77 |
|
TABLE_EL | |
| 78 |
|
TABLE_CELL_EL | |
| 79 |
|
MISC_SCOPING_EL |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
sub TABLE_SCOPING_EL () { |
| 83 |
|
HTML_EL | |
| 84 |
|
TABLE_EL |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
sub TABLE_ROWS_SCOPING_EL () { |
| 88 |
|
HTML_EL | |
| 89 |
|
TABLE_ROW_GROUP_EL |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
sub TABLE_ROW_SCOPING_EL () { |
| 93 |
|
HTML_EL | |
| 94 |
|
TABLE_ROW_EL |
| 95 |
|
} |
| 96 |
|
|
| 97 |
|
sub SPECIAL_EL () { |
| 98 |
|
ADDRESS_EL | |
| 99 |
|
BODY_EL | |
| 100 |
|
DIV_EL | |
| 101 |
|
END_TAG_OPTIONAL_EL | |
| 102 |
|
FORM_EL | |
| 103 |
|
FRAMESET_EL | |
| 104 |
|
HEADING_EL | |
| 105 |
|
OPTION_EL | |
| 106 |
|
OPTGROUP_EL | |
| 107 |
|
SELECT_EL | |
| 108 |
|
TABLE_ROW_EL | |
| 109 |
|
TABLE_ROW_GROUP_EL | |
| 110 |
|
MISC_SPECIAL_EL |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
my $el_category = { |
| 114 |
|
a => A_EL | FORMATTING_EL, |
| 115 |
|
address => ADDRESS_EL, |
| 116 |
|
applet => MISC_SCOPING_EL, |
| 117 |
|
area => MISC_SPECIAL_EL, |
| 118 |
|
b => FORMATTING_EL, |
| 119 |
|
base => MISC_SPECIAL_EL, |
| 120 |
|
basefont => MISC_SPECIAL_EL, |
| 121 |
|
bgsound => MISC_SPECIAL_EL, |
| 122 |
|
big => FORMATTING_EL, |
| 123 |
|
blockquote => MISC_SPECIAL_EL, |
| 124 |
|
body => BODY_EL, |
| 125 |
|
br => MISC_SPECIAL_EL, |
| 126 |
|
button => BUTTON_EL, |
| 127 |
|
caption => CAPTION_EL, |
| 128 |
|
center => MISC_SPECIAL_EL, |
| 129 |
|
col => MISC_SPECIAL_EL, |
| 130 |
|
colgroup => MISC_SPECIAL_EL, |
| 131 |
|
dd => DD_EL, |
| 132 |
|
dir => MISC_SPECIAL_EL, |
| 133 |
|
div => DIV_EL, |
| 134 |
|
dl => MISC_SPECIAL_EL, |
| 135 |
|
dt => DT_EL, |
| 136 |
|
em => FORMATTING_EL, |
| 137 |
|
embed => MISC_SPECIAL_EL, |
| 138 |
|
fieldset => MISC_SPECIAL_EL, |
| 139 |
|
font => FORMATTING_EL, |
| 140 |
|
form => FORM_EL, |
| 141 |
|
frame => MISC_SPECIAL_EL, |
| 142 |
|
frameset => FRAMESET_EL, |
| 143 |
|
h1 => HEADING_EL, |
| 144 |
|
h2 => HEADING_EL, |
| 145 |
|
h3 => HEADING_EL, |
| 146 |
|
h4 => HEADING_EL, |
| 147 |
|
h5 => HEADING_EL, |
| 148 |
|
h6 => HEADING_EL, |
| 149 |
|
head => MISC_SPECIAL_EL, |
| 150 |
|
hr => MISC_SPECIAL_EL, |
| 151 |
|
html => HTML_EL, |
| 152 |
|
i => FORMATTING_EL, |
| 153 |
|
iframe => MISC_SPECIAL_EL, |
| 154 |
|
img => MISC_SPECIAL_EL, |
| 155 |
|
input => MISC_SPECIAL_EL, |
| 156 |
|
isindex => MISC_SPECIAL_EL, |
| 157 |
|
li => LI_EL, |
| 158 |
|
link => MISC_SPECIAL_EL, |
| 159 |
|
listing => MISC_SPECIAL_EL, |
| 160 |
|
marquee => MISC_SCOPING_EL, |
| 161 |
|
menu => MISC_SPECIAL_EL, |
| 162 |
|
meta => MISC_SPECIAL_EL, |
| 163 |
|
nobr => NOBR_EL | FORMATTING_EL, |
| 164 |
|
noembed => MISC_SPECIAL_EL, |
| 165 |
|
noframes => MISC_SPECIAL_EL, |
| 166 |
|
noscript => MISC_SPECIAL_EL, |
| 167 |
|
object => MISC_SCOPING_EL, |
| 168 |
|
ol => MISC_SPECIAL_EL, |
| 169 |
|
optgroup => OPTGROUP_EL, |
| 170 |
|
option => OPTION_EL, |
| 171 |
|
p => P_EL, |
| 172 |
|
param => MISC_SPECIAL_EL, |
| 173 |
|
plaintext => MISC_SPECIAL_EL, |
| 174 |
|
pre => MISC_SPECIAL_EL, |
| 175 |
|
s => FORMATTING_EL, |
| 176 |
|
script => MISC_SPECIAL_EL, |
| 177 |
|
select => SELECT_EL, |
| 178 |
|
small => FORMATTING_EL, |
| 179 |
|
spacer => MISC_SPECIAL_EL, |
| 180 |
|
strike => FORMATTING_EL, |
| 181 |
|
strong => FORMATTING_EL, |
| 182 |
|
style => MISC_SPECIAL_EL, |
| 183 |
|
table => TABLE_EL, |
| 184 |
|
tbody => TABLE_ROW_GROUP_EL, |
| 185 |
|
td => TABLE_CELL_EL, |
| 186 |
|
textarea => MISC_SPECIAL_EL, |
| 187 |
|
tfoot => TABLE_ROW_GROUP_EL, |
| 188 |
|
th => TABLE_CELL_EL, |
| 189 |
|
thead => TABLE_ROW_GROUP_EL, |
| 190 |
|
title => MISC_SPECIAL_EL, |
| 191 |
|
tr => TABLE_ROW_EL, |
| 192 |
|
tt => FORMATTING_EL, |
| 193 |
|
u => FORMATTING_EL, |
| 194 |
|
ul => MISC_SPECIAL_EL, |
| 195 |
|
wbr => MISC_SPECIAL_EL, |
| 196 |
}; |
}; |
| 197 |
|
|
| 198 |
|
my $el_category_f = { |
| 199 |
|
$MML_NS => { |
| 200 |
|
'annotation-xml' => MML_AXML_EL, |
| 201 |
|
mi => FOREIGN_FLOW_CONTENT_EL, |
| 202 |
|
mo => FOREIGN_FLOW_CONTENT_EL, |
| 203 |
|
mn => FOREIGN_FLOW_CONTENT_EL, |
| 204 |
|
ms => FOREIGN_FLOW_CONTENT_EL, |
| 205 |
|
mtext => FOREIGN_FLOW_CONTENT_EL, |
| 206 |
|
}, |
| 207 |
|
$SVG_NS => { |
| 208 |
|
foreignObject => FOREIGN_FLOW_CONTENT_EL, |
| 209 |
|
desc => FOREIGN_FLOW_CONTENT_EL, |
| 210 |
|
title => FOREIGN_FLOW_CONTENT_EL, |
| 211 |
|
}, |
| 212 |
|
## NOTE: In addition, FOREIGN_EL is set to non-HTML elements. |
| 213 |
|
}; |
| 214 |
|
|
| 215 |
|
my $svg_attr_name = { |
| 216 |
|
attributetype => 'attributeType', |
| 217 |
|
basefrequency => 'baseFrequency', |
| 218 |
|
baseprofile => 'baseProfile', |
| 219 |
|
calcmode => 'calcMode', |
| 220 |
|
clippathunits => 'clipPathUnits', |
| 221 |
|
contentscripttype => 'contentScriptType', |
| 222 |
|
contentstyletype => 'contentStyleType', |
| 223 |
|
diffuseconstant => 'diffuseConstant', |
| 224 |
|
edgemode => 'edgeMode', |
| 225 |
|
externalresourcesrequired => 'externalResourcesRequired', |
| 226 |
|
fecolormatrix => 'feColorMatrix', |
| 227 |
|
fecomposite => 'feComposite', |
| 228 |
|
fegaussianblur => 'feGaussianBlur', |
| 229 |
|
femorphology => 'feMorphology', |
| 230 |
|
fetile => 'feTile', |
| 231 |
|
filterres => 'filterRes', |
| 232 |
|
filterunits => 'filterUnits', |
| 233 |
|
glyphref => 'glyphRef', |
| 234 |
|
gradienttransform => 'gradientTransform', |
| 235 |
|
gradientunits => 'gradientUnits', |
| 236 |
|
kernelmatrix => 'kernelMatrix', |
| 237 |
|
kernelunitlength => 'kernelUnitLength', |
| 238 |
|
keypoints => 'keyPoints', |
| 239 |
|
keysplines => 'keySplines', |
| 240 |
|
keytimes => 'keyTimes', |
| 241 |
|
lengthadjust => 'lengthAdjust', |
| 242 |
|
limitingconeangle => 'limitingConeAngle', |
| 243 |
|
markerheight => 'markerHeight', |
| 244 |
|
markerunits => 'markerUnits', |
| 245 |
|
markerwidth => 'markerWidth', |
| 246 |
|
maskcontentunits => 'maskContentUnits', |
| 247 |
|
maskunits => 'maskUnits', |
| 248 |
|
numoctaves => 'numOctaves', |
| 249 |
|
pathlength => 'pathLength', |
| 250 |
|
patterncontentunits => 'patternContentUnits', |
| 251 |
|
patterntransform => 'patternTransform', |
| 252 |
|
patternunits => 'patternUnits', |
| 253 |
|
pointsatx => 'pointsAtX', |
| 254 |
|
pointsaty => 'pointsAtY', |
| 255 |
|
pointsatz => 'pointsAtZ', |
| 256 |
|
preservealpha => 'preserveAlpha', |
| 257 |
|
preserveaspectratio => 'preserveAspectRatio', |
| 258 |
|
primitiveunits => 'primitiveUnits', |
| 259 |
|
refx => 'refX', |
| 260 |
|
refy => 'refY', |
| 261 |
|
repeatcount => 'repeatCount', |
| 262 |
|
repeatdur => 'repeatDur', |
| 263 |
|
requiredextensions => 'requiredExtensions', |
| 264 |
|
specularconstant => 'specularConstant', |
| 265 |
|
specularexponent => 'specularExponent', |
| 266 |
|
spreadmethod => 'spreadMethod', |
| 267 |
|
startoffset => 'startOffset', |
| 268 |
|
stddeviation => 'stdDeviation', |
| 269 |
|
stitchtiles => 'stitchTiles', |
| 270 |
|
surfacescale => 'surfaceScale', |
| 271 |
|
systemlanguage => 'systemLanguage', |
| 272 |
|
tablevalues => 'tableValues', |
| 273 |
|
targetx => 'targetX', |
| 274 |
|
targety => 'targetY', |
| 275 |
|
textlength => 'textLength', |
| 276 |
|
viewbox => 'viewBox', |
| 277 |
|
viewtarget => 'viewTarget', |
| 278 |
|
xchannelselector => 'xChannelSelector', |
| 279 |
|
ychannelselector => 'yChannelSelector', |
| 280 |
|
zoomandpan => 'zoomAndPan', |
| 281 |
|
}; |
| 282 |
|
|
| 283 |
|
my $foreign_attr_xname = { |
| 284 |
|
'xlink:actuate' => [$XLINK_NS, ['xlink', 'actuate']], |
| 285 |
|
'xlink:arcrole' => [$XLINK_NS, ['xlink', 'arcrole']], |
| 286 |
|
'xlink:href' => [$XLINK_NS, ['xlink', 'href']], |
| 287 |
|
'xlink:role' => [$XLINK_NS, ['xlink', 'role']], |
| 288 |
|
'xlink:show' => [$XLINK_NS, ['xlink', 'show']], |
| 289 |
|
'xlink:title' => [$XLINK_NS, ['xlink', 'title']], |
| 290 |
|
'xlink:type' => [$XLINK_NS, ['xlink', 'type']], |
| 291 |
|
'xml:base' => [$XML_NS, ['xml', 'base']], |
| 292 |
|
'xml:lang' => [$XML_NS, ['xml', 'lang']], |
| 293 |
|
'xml:space' => [$XML_NS, ['xml', 'space']], |
| 294 |
|
'xmlns' => [$XMLNS_NS, [undef, 'xmlns']], |
| 295 |
|
'xmlns:xlink' => [$XMLNS_NS, ['xmlns', 'xlink']], |
| 296 |
|
}; |
| 297 |
|
|
| 298 |
|
## ISSUE: xmlns:xlink="non-xlink-ns" is not an error. |
| 299 |
|
|
| 300 |
my $c1_entity_char = { |
my $c1_entity_char = { |
| 301 |
0x80 => 0x20AC, |
0x80 => 0x20AC, |
| 302 |
0x81 => 0xFFFD, |
0x81 => 0xFFFD, |
| 332 |
0x9F => 0x0178, |
0x9F => 0x0178, |
| 333 |
}; # $c1_entity_char |
}; # $c1_entity_char |
| 334 |
|
|
|
my $special_category = { |
|
|
address => 1, area => 1, base => 1, basefont => 1, bgsound => 1, |
|
|
blockquote => 1, body => 1, br => 1, center => 1, col => 1, colgroup => 1, |
|
|
dd => 1, dir => 1, div => 1, dl => 1, dt => 1, embed => 1, fieldset => 1, |
|
|
form => 1, frame => 1, frameset => 1, h1 => 1, h2 => 1, h3 => 1, |
|
|
h4 => 1, h5 => 1, h6 => 1, head => 1, hr => 1, iframe => 1, image => 1, |
|
|
img => 1, input => 1, isindex => 1, li => 1, link => 1, listing => 1, |
|
|
menu => 1, meta => 1, noembed => 1, noframes => 1, noscript => 1, |
|
|
ol => 1, optgroup => 1, option => 1, p => 1, param => 1, plaintext => 1, |
|
|
pre => 1, script => 1, select => 1, spacer => 1, style => 1, tbody => 1, |
|
|
textarea => 1, tfoot => 1, thead => 1, title => 1, tr => 1, ul => 1, wbr => 1, |
|
|
}; |
|
|
my $scoping_category = { |
|
|
applet => 1, button => 1, caption => 1, html => 1, marquee => 1, object => 1, |
|
|
table => 1, td => 1, th => 1, |
|
|
}; |
|
|
my $formatting_category = { |
|
|
a => 1, b => 1, big => 1, em => 1, font => 1, i => 1, nobr => 1, |
|
|
s => 1, small => 1, strile => 1, strong => 1, tt => 1, u => 1, |
|
|
}; |
|
|
# $phrasing_category: all other elements |
|
|
|
|
| 335 |
sub parse_byte_string ($$$$;$) { |
sub parse_byte_string ($$$$;$) { |
| 336 |
my $self = ref $_[0] ? shift : shift->new; |
my $self = ref $_[0] ? shift : shift->new; |
| 337 |
my $charset = shift; |
my $charset = shift; |
| 544 |
sub AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE () { 31 } |
sub AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE () { 31 } |
| 545 |
sub BOGUS_DOCTYPE_STATE () { 32 } |
sub BOGUS_DOCTYPE_STATE () { 32 } |
| 546 |
sub AFTER_ATTRIBUTE_VALUE_QUOTED_STATE () { 33 } |
sub AFTER_ATTRIBUTE_VALUE_QUOTED_STATE () { 33 } |
| 547 |
|
sub SELF_CLOSING_START_TAG_STATE () { 34 } |
| 548 |
|
sub CDATA_BLOCK_STATE () { 35 } |
| 549 |
|
|
| 550 |
sub DOCTYPE_TOKEN () { 1 } |
sub DOCTYPE_TOKEN () { 1 } |
| 551 |
sub COMMENT_TOKEN () { 2 } |
sub COMMENT_TOKEN () { 2 } |
| 563 |
sub BODY_AFTER_IMS () { 0b100000000 } |
sub BODY_AFTER_IMS () { 0b100000000 } |
| 564 |
sub FRAME_IMS () { 0b1000000000 } |
sub FRAME_IMS () { 0b1000000000 } |
| 565 |
sub SELECT_IMS () { 0b10000000000 } |
sub SELECT_IMS () { 0b10000000000 } |
| 566 |
|
sub IN_FOREIGN_CONTENT_IM () { 0b100000000000 } |
| 567 |
|
## NOTE: "in foreign content" insertion mode is special; it is combined |
| 568 |
|
## with the secondary insertion mode. In this parser, they are stored |
| 569 |
|
## together in the bit-or'ed form. |
| 570 |
|
|
| 571 |
## NOTE: "initial" and "before html" insertion modes have no constants. |
## NOTE: "initial" and "before html" insertion modes have no constants. |
| 572 |
|
|
| 603 |
undef $self->{current_attribute}; |
undef $self->{current_attribute}; |
| 604 |
undef $self->{last_emitted_start_tag_name}; |
undef $self->{last_emitted_start_tag_name}; |
| 605 |
undef $self->{last_attribute_value_state}; |
undef $self->{last_attribute_value_state}; |
| 606 |
|
delete $self->{self_closing}; |
| 607 |
$self->{char} = []; |
$self->{char} = []; |
| 608 |
# $self->{next_char} |
# $self->{next_char} |
| 609 |
!!!next-input-character; |
!!!next-input-character; |
| 624 |
## ->{value} |
## ->{value} |
| 625 |
## ->{has_reference} == 1 or 0 |
## ->{has_reference} == 1 or 0 |
| 626 |
## ->{data} (COMMENT_TOKEN, CHARACTER_TOKEN) |
## ->{data} (COMMENT_TOKEN, CHARACTER_TOKEN) |
| 627 |
|
## NOTE: The "self-closing flag" is hold as |$self->{self_closing}|. |
| 628 |
|
## |->{self_closing}| is used to save the value of |$self->{self_closing}| |
| 629 |
|
## while the token is pushed back to the stack. |
| 630 |
|
|
| 631 |
|
## ISSUE: "When a DOCTYPE token is created, its |
| 632 |
|
## <i>self-closing flag</i> must be unset (its other state is that it |
| 633 |
|
## be set), and its attributes list must be empty.": Wrong subject? |
| 634 |
|
|
| 635 |
## Emitted token MUST immediately be handled by the tree construction state. |
## Emitted token MUST immediately be handled by the tree construction state. |
| 636 |
|
|
| 657 |
|
|
| 658 |
sub _get_next_token ($) { |
sub _get_next_token ($) { |
| 659 |
my $self = shift; |
my $self = shift; |
| 660 |
|
|
| 661 |
|
if ($self->{self_closing}) { |
| 662 |
|
!!!parse-error (type => 'nestc', token => $self->{current_token}); |
| 663 |
|
## NOTE: The |self_closing| flag is only set by start tag token. |
| 664 |
|
## In addition, when a start tag token is emitted, it is always set to |
| 665 |
|
## |current_token|. |
| 666 |
|
delete $self->{self_closing}; |
| 667 |
|
} |
| 668 |
|
|
| 669 |
if (@{$self->{token}}) { |
if (@{$self->{token}}) { |
| 670 |
|
$self->{self_closing} = $self->{token}->[0]->{self_closing}; |
| 671 |
return shift @{$self->{token}}; |
return shift @{$self->{token}}; |
| 672 |
} |
} |
| 673 |
|
|
| 1038 |
|
|
| 1039 |
redo A; |
redo A; |
| 1040 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
| 1041 |
|
!!!cp (42); |
| 1042 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
| 1043 |
!!!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 |
|
| 1044 |
redo A; |
redo A; |
| 1045 |
} else { |
} else { |
| 1046 |
!!!cp (44); |
!!!cp (44); |
| 1092 |
!!!next-input-character; |
!!!next-input-character; |
| 1093 |
redo A; |
redo A; |
| 1094 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
| 1095 |
|
!!!cp (50); |
| 1096 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
| 1097 |
!!!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 |
|
| 1098 |
redo A; |
redo A; |
| 1099 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
| 1100 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
| 1195 |
!!!next-input-character; |
!!!next-input-character; |
| 1196 |
redo A; |
redo A; |
| 1197 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
| 1198 |
|
!!!cp (64); |
| 1199 |
$before_leave->(); |
$before_leave->(); |
| 1200 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
| 1201 |
!!!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 |
|
| 1202 |
redo A; |
redo A; |
| 1203 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
| 1204 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
| 1285 |
!!!next-input-character; |
!!!next-input-character; |
| 1286 |
redo A; |
redo A; |
| 1287 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
| 1288 |
|
!!!cp (77); |
| 1289 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
| 1290 |
!!!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 |
|
| 1291 |
redo A; |
redo A; |
| 1292 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
| 1293 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
| 1620 |
|
|
| 1621 |
redo A; |
redo A; |
| 1622 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
| 1623 |
|
!!!cp (122); |
| 1624 |
|
$self->{state} = SELF_CLOSING_START_TAG_STATE; |
| 1625 |
!!!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 |
|
| 1626 |
redo A; |
redo A; |
| 1627 |
} else { |
} else { |
| 1628 |
!!!cp (124); |
!!!cp ('124.1'); |
| 1629 |
!!!parse-error (type => 'no space between attributes'); |
!!!parse-error (type => 'no space between attributes'); |
| 1630 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
| 1631 |
## reconsume |
## reconsume |
| 1632 |
redo A; |
redo A; |
| 1633 |
} |
} |
| 1634 |
|
} elsif ($self->{state} == SELF_CLOSING_START_TAG_STATE) { |
| 1635 |
|
if ($self->{next_char} == 0x003E) { # > |
| 1636 |
|
if ($self->{current_token}->{type} == END_TAG_TOKEN) { |
| 1637 |
|
!!!cp ('124.2'); |
| 1638 |
|
!!!parse-error (type => 'nestc', token => $self->{current_token}); |
| 1639 |
|
## TODO: Different type than slash in start tag |
| 1640 |
|
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
| 1641 |
|
if ($self->{current_token}->{attributes}) { |
| 1642 |
|
!!!cp ('124.4'); |
| 1643 |
|
!!!parse-error (type => 'end tag attribute'); |
| 1644 |
|
} else { |
| 1645 |
|
!!!cp ('124.5'); |
| 1646 |
|
} |
| 1647 |
|
## TODO: Test |<title></title/>| |
| 1648 |
|
} else { |
| 1649 |
|
!!!cp ('124.3'); |
| 1650 |
|
$self->{self_closing} = 1; |
| 1651 |
|
} |
| 1652 |
|
|
| 1653 |
|
$self->{state} = DATA_STATE; |
| 1654 |
|
!!!next-input-character; |
| 1655 |
|
|
| 1656 |
|
!!!emit ($self->{current_token}); # start tag or end tag |
| 1657 |
|
|
| 1658 |
|
redo A; |
| 1659 |
|
} else { |
| 1660 |
|
!!!cp ('124.4'); |
| 1661 |
|
!!!parse-error (type => 'nestc'); |
| 1662 |
|
## TODO: This error type is wrong. |
| 1663 |
|
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
| 1664 |
|
## Reconsume. |
| 1665 |
|
redo A; |
| 1666 |
|
} |
| 1667 |
} elsif ($self->{state} == BOGUS_COMMENT_STATE) { |
} elsif ($self->{state} == BOGUS_COMMENT_STATE) { |
| 1668 |
## (only happen if PCDATA state) |
## (only happen if PCDATA state) |
| 1669 |
|
|
| 1771 |
} else { |
} else { |
| 1772 |
!!!cp (135); |
!!!cp (135); |
| 1773 |
} |
} |
| 1774 |
|
} elsif ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM and |
| 1775 |
|
$self->{open_elements}->[-1]->[1] & FOREIGN_EL and |
| 1776 |
|
$self->{next_char} == 0x005B) { # [ |
| 1777 |
|
!!!next-input-character; |
| 1778 |
|
push @next_char, $self->{next_char}; |
| 1779 |
|
if ($self->{next_char} == 0x0043) { # C |
| 1780 |
|
!!!next-input-character; |
| 1781 |
|
push @next_char, $self->{next_char}; |
| 1782 |
|
if ($self->{next_char} == 0x0044) { # D |
| 1783 |
|
!!!next-input-character; |
| 1784 |
|
push @next_char, $self->{next_char}; |
| 1785 |
|
if ($self->{next_char} == 0x0041) { # A |
| 1786 |
|
!!!next-input-character; |
| 1787 |
|
push @next_char, $self->{next_char}; |
| 1788 |
|
if ($self->{next_char} == 0x0054) { # T |
| 1789 |
|
!!!next-input-character; |
| 1790 |
|
push @next_char, $self->{next_char}; |
| 1791 |
|
if ($self->{next_char} == 0x0041) { # A |
| 1792 |
|
!!!next-input-character; |
| 1793 |
|
push @next_char, $self->{next_char}; |
| 1794 |
|
if ($self->{next_char} == 0x005B) { # [ |
| 1795 |
|
!!!cp (135.1); |
| 1796 |
|
$self->{state} = CDATA_BLOCK_STATE; |
| 1797 |
|
!!!next-input-character; |
| 1798 |
|
redo A; |
| 1799 |
|
} else { |
| 1800 |
|
!!!cp (135.2); |
| 1801 |
|
} |
| 1802 |
|
} else { |
| 1803 |
|
!!!cp (135.3); |
| 1804 |
|
} |
| 1805 |
|
} else { |
| 1806 |
|
!!!cp (135.4); |
| 1807 |
|
} |
| 1808 |
|
} else { |
| 1809 |
|
!!!cp (135.5); |
| 1810 |
|
} |
| 1811 |
|
} else { |
| 1812 |
|
!!!cp (135.6); |
| 1813 |
|
} |
| 1814 |
|
} else { |
| 1815 |
|
!!!cp (135.7); |
| 1816 |
|
} |
| 1817 |
} else { |
} else { |
| 1818 |
!!!cp (136); |
!!!cp (136); |
| 1819 |
} |
} |
| 2538 |
!!!next-input-character; |
!!!next-input-character; |
| 2539 |
redo A; |
redo A; |
| 2540 |
} |
} |
| 2541 |
|
} elsif ($self->{state} == CDATA_BLOCK_STATE) { |
| 2542 |
|
my $s = ''; |
| 2543 |
|
|
| 2544 |
|
my ($l, $c) = ($self->{line}, $self->{column}); |
| 2545 |
|
|
| 2546 |
|
CS: while ($self->{next_char} != -1) { |
| 2547 |
|
if ($self->{next_char} == 0x005D) { # ] |
| 2548 |
|
!!!next-input-character; |
| 2549 |
|
if ($self->{next_char} == 0x005D) { # ] |
| 2550 |
|
!!!next-input-character; |
| 2551 |
|
MDC: { |
| 2552 |
|
if ($self->{next_char} == 0x003E) { # > |
| 2553 |
|
!!!cp (221.1); |
| 2554 |
|
!!!next-input-character; |
| 2555 |
|
last CS; |
| 2556 |
|
} elsif ($self->{next_char} == 0x005D) { # ] |
| 2557 |
|
!!!cp (221.2); |
| 2558 |
|
$s .= ']'; |
| 2559 |
|
!!!next-input-character; |
| 2560 |
|
redo MDC; |
| 2561 |
|
} else { |
| 2562 |
|
!!!cp (221.3); |
| 2563 |
|
$s .= ']]'; |
| 2564 |
|
# |
| 2565 |
|
} |
| 2566 |
|
} # MDC |
| 2567 |
|
} else { |
| 2568 |
|
!!!cp (221.4); |
| 2569 |
|
$s .= ']'; |
| 2570 |
|
# |
| 2571 |
|
} |
| 2572 |
|
} else { |
| 2573 |
|
!!!cp (221.5); |
| 2574 |
|
# |
| 2575 |
|
} |
| 2576 |
|
$s .= chr $self->{next_char}; |
| 2577 |
|
!!!next-input-character; |
| 2578 |
|
} # CS |
| 2579 |
|
|
| 2580 |
|
$self->{state} = DATA_STATE; |
| 2581 |
|
## next-input-character done or EOF, which is reconsumed. |
| 2582 |
|
|
| 2583 |
|
if (length $s) { |
| 2584 |
|
!!!cp (221.6); |
| 2585 |
|
!!!emit ({type => CHARACTER_TOKEN, data => $s, |
| 2586 |
|
line => $l, column => $c}); |
| 2587 |
|
} else { |
| 2588 |
|
!!!cp (221.7); |
| 2589 |
|
} |
| 2590 |
|
|
| 2591 |
|
redo A; |
| 2592 |
|
|
| 2593 |
|
## ISSUE: "text tokens" in spec. |
| 2594 |
|
## TODO: Streaming support |
| 2595 |
} else { |
} else { |
| 2596 |
die "$0: $self->{state}: Unknown state"; |
die "$0: $self->{state}: Unknown state"; |
| 2597 |
} |
} |
| 2742 |
require Whatpm::_NamedEntityList; |
require Whatpm::_NamedEntityList; |
| 2743 |
our $EntityChar; |
our $EntityChar; |
| 2744 |
|
|
| 2745 |
while (length $entity_name < 10 and |
while (length $entity_name < 30 and |
| 2746 |
## NOTE: Some number greater than the maximum length of entity name |
## NOTE: Some number greater than the maximum length of entity name |
| 2747 |
((0x0041 <= $self->{next_char} and # a |
((0x0041 <= $self->{next_char} and # a |
| 2748 |
$self->{next_char} <= 0x005A) or # x |
$self->{next_char} <= 0x005A) or # x |
| 2884 |
|
|
| 2885 |
my $doctype = $self->{document}->create_document_type_definition |
my $doctype = $self->{document}->create_document_type_definition |
| 2886 |
($token->{name}); ## ISSUE: If name is missing (e.g. <!DOCTYPE>)? |
($token->{name}); ## ISSUE: If name is missing (e.g. <!DOCTYPE>)? |
| 2887 |
|
## NOTE: Default value for both |public_id| and |system_id| attributes |
| 2888 |
|
## are empty strings, so that we don't set any value in missing cases. |
| 2889 |
$doctype->public_id ($token->{public_identifier}) |
$doctype->public_id ($token->{public_identifier}) |
| 2890 |
if defined $token->{public_identifier}; |
if defined $token->{public_identifier}; |
| 2891 |
$doctype->system_id ($token->{system_identifier}) |
$doctype->system_id ($token->{system_identifier}) |
| 3022 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
| 3023 |
## Go to the "before html" insertion mode. |
## Go to the "before html" insertion mode. |
| 3024 |
## reprocess |
## reprocess |
| 3025 |
|
!!!ack-later; |
| 3026 |
return; |
return; |
| 3027 |
} elsif ($token->{type} == CHARACTER_TOKEN) { |
} elsif ($token->{type} == CHARACTER_TOKEN) { |
| 3028 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { # \x0D |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { # \x0D |
| 3103 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 3104 |
if ($token->{tag_name} eq 'html') { |
if ($token->{tag_name} eq 'html') { |
| 3105 |
my $root_element; |
my $root_element; |
| 3106 |
!!!create-element ($root_element, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($root_element, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
| 3107 |
$self->{document}->append_child ($root_element); |
$self->{document}->append_child ($root_element); |
| 3108 |
push @{$self->{open_elements}}, [$root_element, 'html']; |
push @{$self->{open_elements}}, |
| 3109 |
|
[$root_element, $el_category->{html}]; |
| 3110 |
|
|
| 3111 |
if ($token->{attributes}->{manifest}) { |
if ($token->{attributes}->{manifest}) { |
| 3112 |
!!!cp ('t24'); |
!!!cp ('t24'); |
| 3121 |
$self->{application_cache_selection}->(undef); |
$self->{application_cache_selection}->(undef); |
| 3122 |
} |
} |
| 3123 |
|
|
| 3124 |
|
!!!nack ('t25c'); |
| 3125 |
|
|
| 3126 |
!!!next-token; |
!!!next-token; |
| 3127 |
return; ## Go to the "before head" insertion mode. |
return; ## Go to the "before head" insertion mode. |
| 3128 |
} else { |
} else { |
| 3139 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 3140 |
} |
} |
| 3141 |
|
|
| 3142 |
my $root_element; !!!create-element ($root_element, 'html',, $token); |
my $root_element; |
| 3143 |
|
!!!create-element ($root_element, $HTML_NS, 'html',, $token); |
| 3144 |
$self->{document}->append_child ($root_element); |
$self->{document}->append_child ($root_element); |
| 3145 |
push @{$self->{open_elements}}, [$root_element, 'html']; |
push @{$self->{open_elements}}, [$root_element, $el_category->{html}]; |
| 3146 |
|
|
| 3147 |
$self->{application_cache_selection}->(undef); |
$self->{application_cache_selection}->(undef); |
| 3148 |
|
|
| 3149 |
## NOTE: Reprocess the token. |
## NOTE: Reprocess the token. |
| 3150 |
|
!!!ack-later; |
| 3151 |
return; ## Go to the "before head" insertion mode. |
return; ## Go to the "before head" insertion mode. |
| 3152 |
|
|
| 3153 |
## ISSUE: There is an issue in the spec |
## ISSUE: There is an issue in the spec |
| 3171 |
if ($self->{open_elements}->[0]->[0] eq $node->[0]) { |
if ($self->{open_elements}->[0]->[0] eq $node->[0]) { |
| 3172 |
$last = 1; |
$last = 1; |
| 3173 |
if (defined $self->{inner_html_node}) { |
if (defined $self->{inner_html_node}) { |
| 3174 |
if ($self->{inner_html_node}->[1] eq 'td' or |
if ($self->{inner_html_node}->[1] & TABLE_CELL_EL) { |
|
$self->{inner_html_node}->[1] eq 'th') { |
|
| 3175 |
!!!cp ('t27'); |
!!!cp ('t27'); |
| 3176 |
# |
# |
| 3177 |
} else { |
} else { |
| 3181 |
} |
} |
| 3182 |
} |
} |
| 3183 |
|
|
| 3184 |
## Step 4..13 |
## Step 4..14 |
| 3185 |
my $new_mode = { |
my $new_mode; |
| 3186 |
|
if ($node->[1] & FOREIGN_EL) { |
| 3187 |
|
## NOTE: Strictly spaking, the line below only applies to MathML and |
| 3188 |
|
## SVG elements. Currently the HTML syntax supports only MathML and |
| 3189 |
|
## SVG elements as foreigners. |
| 3190 |
|
$new_mode = $self->{insertion_mode} | IN_FOREIGN_CONTENT_IM; |
| 3191 |
|
## ISSUE: What is set as the secondary insertion mode? |
| 3192 |
|
} else { |
| 3193 |
|
$new_mode = { |
| 3194 |
select => IN_SELECT_IM, |
select => IN_SELECT_IM, |
| 3195 |
## NOTE: |option| and |optgroup| do not set |
## NOTE: |option| and |optgroup| do not set |
| 3196 |
## insertion mode to "in select" by themselves. |
## insertion mode to "in select" by themselves. |
| 3206 |
head => IN_BODY_IM, # not in head! |
head => IN_BODY_IM, # not in head! |
| 3207 |
body => IN_BODY_IM, |
body => IN_BODY_IM, |
| 3208 |
frameset => IN_FRAMESET_IM, |
frameset => IN_FRAMESET_IM, |
| 3209 |
}->{$node->[1]}; |
}->{$node->[0]->manakai_local_name}; |
| 3210 |
$self->{insertion_mode} = $new_mode and return if defined $new_mode; |
} |
| 3211 |
|
$self->{insertion_mode} = $new_mode and return if defined $new_mode; |
| 3212 |
|
|
| 3213 |
## Step 14 |
## Step 15 |
| 3214 |
if ($node->[1] eq 'html') { |
if ($node->[1] & HTML_EL) { |
| 3215 |
unless (defined $self->{head_element}) { |
unless (defined $self->{head_element}) { |
| 3216 |
!!!cp ('t29'); |
!!!cp ('t29'); |
| 3217 |
$self->{insertion_mode} = BEFORE_HEAD_IM; |
$self->{insertion_mode} = BEFORE_HEAD_IM; |
| 3225 |
!!!cp ('t31'); |
!!!cp ('t31'); |
| 3226 |
} |
} |
| 3227 |
|
|
| 3228 |
## Step 15 |
## Step 16 |
| 3229 |
$self->{insertion_mode} = IN_BODY_IM and return if $last; |
$self->{insertion_mode} = IN_BODY_IM and return if $last; |
| 3230 |
|
|
| 3231 |
## Step 16 |
## Step 17 |
| 3232 |
$i--; |
$i--; |
| 3233 |
$node = $self->{open_elements}->[$i]; |
$node = $self->{open_elements}->[$i]; |
| 3234 |
|
|
| 3235 |
## Step 17 |
## Step 18 |
| 3236 |
redo S3; |
redo S3; |
| 3237 |
} # S3 |
} # S3 |
| 3238 |
|
|
| 3344 |
## Step 1 |
## Step 1 |
| 3345 |
my $start_tag_name = $token->{tag_name}; |
my $start_tag_name = $token->{tag_name}; |
| 3346 |
my $el; |
my $el; |
| 3347 |
!!!create-element ($el, $start_tag_name, $token->{attributes}, $token); |
!!!create-element ($el, $HTML_NS, $start_tag_name, $token->{attributes}, $token); |
| 3348 |
|
|
| 3349 |
## Step 2 |
## Step 2 |
| 3350 |
$insert->($el); |
$insert->($el); |
| 3355 |
|
|
| 3356 |
## Step 4 |
## Step 4 |
| 3357 |
my $text = ''; |
my $text = ''; |
| 3358 |
|
!!!nack ('t40.1'); |
| 3359 |
!!!next-token; |
!!!next-token; |
| 3360 |
while ($token->{type} == CHARACTER_TOKEN) { # or until stop tokenizing |
while ($token->{type} == CHARACTER_TOKEN) { # or until stop tokenizing |
| 3361 |
!!!cp ('t40'); |
!!!cp ('t40'); |
| 3395 |
|
|
| 3396 |
my $script_start_tag = sub () { |
my $script_start_tag = sub () { |
| 3397 |
my $script_el; |
my $script_el; |
| 3398 |
!!!create-element ($script_el, 'script', $token->{attributes}, $token); |
!!!create-element ($script_el, $HTML_NS, 'script', $token->{attributes}, $token); |
| 3399 |
## TODO: mark as "parser-inserted" |
## TODO: mark as "parser-inserted" |
| 3400 |
|
|
| 3401 |
$self->{content_model} = CDATA_CONTENT_MODEL; |
$self->{content_model} = CDATA_CONTENT_MODEL; |
| 3402 |
delete $self->{escape}; # MUST |
delete $self->{escape}; # MUST |
| 3403 |
|
|
| 3404 |
my $text = ''; |
my $text = ''; |
| 3405 |
|
!!!nack ('t45.1'); |
| 3406 |
!!!next-token; |
!!!next-token; |
| 3407 |
while ($token->{type} == CHARACTER_TOKEN) { |
while ($token->{type} == CHARACTER_TOKEN) { |
| 3408 |
!!!cp ('t45'); |
!!!cp ('t45'); |
| 3460 |
my $formatting_element; |
my $formatting_element; |
| 3461 |
my $formatting_element_i_in_active; |
my $formatting_element_i_in_active; |
| 3462 |
AFE: for (reverse 0..$#$active_formatting_elements) { |
AFE: for (reverse 0..$#$active_formatting_elements) { |
| 3463 |
if ($active_formatting_elements->[$_]->[1] eq $tag_name) { |
if ($active_formatting_elements->[$_]->[0] eq '#marker') { |
| 3464 |
|
!!!cp ('t52'); |
| 3465 |
|
last AFE; |
| 3466 |
|
} elsif ($active_formatting_elements->[$_]->[0]->manakai_local_name |
| 3467 |
|
eq $tag_name) { |
| 3468 |
!!!cp ('t51'); |
!!!cp ('t51'); |
| 3469 |
$formatting_element = $active_formatting_elements->[$_]; |
$formatting_element = $active_formatting_elements->[$_]; |
| 3470 |
$formatting_element_i_in_active = $_; |
$formatting_element_i_in_active = $_; |
| 3471 |
last AFE; |
last AFE; |
|
} elsif ($active_formatting_elements->[$_]->[0] eq '#marker') { |
|
|
!!!cp ('t52'); |
|
|
last AFE; |
|
| 3472 |
} |
} |
| 3473 |
} # AFE |
} # AFE |
| 3474 |
unless (defined $formatting_element) { |
unless (defined $formatting_element) { |
| 3496 |
!!!next-token; |
!!!next-token; |
| 3497 |
return; |
return; |
| 3498 |
} |
} |
| 3499 |
} elsif ({ |
} elsif ($node->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 3500 |
!!!cp ('t56'); |
!!!cp ('t56'); |
| 3501 |
$in_scope = 0; |
$in_scope = 0; |
| 3502 |
} |
} |
| 3511 |
} |
} |
| 3512 |
if (not $self->{open_elements}->[-1]->[0] eq $formatting_element->[0]) { |
if (not $self->{open_elements}->[-1]->[0] eq $formatting_element->[0]) { |
| 3513 |
!!!cp ('t58'); |
!!!cp ('t58'); |
| 3514 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], |
!!!parse-error (type => 'not closed', |
| 3515 |
|
value => $self->{open_elements}->[-1]->[0] |
| 3516 |
|
->manakai_local_name, |
| 3517 |
token => $end_tag_token); |
token => $end_tag_token); |
| 3518 |
} |
} |
| 3519 |
|
|
| 3522 |
my $furthest_block_i_in_open; |
my $furthest_block_i_in_open; |
| 3523 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
| 3524 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 3525 |
if (not $formatting_category->{$node->[1]} and |
if (not ($node->[1] & FORMATTING_EL) and |
| 3526 |
#not $phrasing_category->{$node->[1]} and |
#not $phrasing_category->{$node->[1]} and |
| 3527 |
($special_category->{$node->[1]} or |
($node->[1] & SPECIAL_EL or |
| 3528 |
$scoping_category->{$node->[1]})) { ## Scoping is redundant, maybe |
$node->[1] & SCOPING_EL)) { ## Scoping is redundant, maybe |
| 3529 |
!!!cp ('t59'); |
!!!cp ('t59'); |
| 3530 |
$furthest_block = $node; |
$furthest_block = $node; |
| 3531 |
$furthest_block_i_in_open = $_; |
$furthest_block_i_in_open = $_; |
| 3611 |
} # S7 |
} # S7 |
| 3612 |
|
|
| 3613 |
## Step 8 |
## Step 8 |
| 3614 |
if ({ |
if ($common_ancestor_node->[1] & TABLE_ROWS_EL) { |
|
table => 1, tbody => 1, tfoot => 1, thead => 1, tr => 1, |
|
|
}->{$common_ancestor_node->[1]}) { |
|
| 3615 |
my $foster_parent_element; |
my $foster_parent_element; |
| 3616 |
my $next_sibling; |
my $next_sibling; |
| 3617 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
| 3618 |
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
if ($self->{open_elements}->[$_]->[1] & TABLE_EL) { |
| 3619 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
| 3620 |
if (defined $parent and $parent->node_type == 1) { |
if (defined $parent and $parent->node_type == 1) { |
| 3621 |
!!!cp ('t65.1'); |
!!!cp ('t65.1'); |
| 3688 |
|
|
| 3689 |
my $insert_to_foster = sub { |
my $insert_to_foster = sub { |
| 3690 |
my $child = shift; |
my $child = shift; |
| 3691 |
if ({ |
if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) { |
|
table => 1, tbody => 1, tfoot => 1, thead => 1, tr => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 3692 |
# MUST |
# MUST |
| 3693 |
my $foster_parent_element; |
my $foster_parent_element; |
| 3694 |
my $next_sibling; |
my $next_sibling; |
| 3695 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
| 3696 |
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
if ($self->{open_elements}->[$_]->[1] & TABLE_EL) { |
| 3697 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
| 3698 |
if (defined $parent and $parent->node_type == 1) { |
if (defined $parent and $parent->node_type == 1) { |
| 3699 |
!!!cp ('t70'); |
!!!cp ('t70'); |
| 3718 |
} |
} |
| 3719 |
}; # $insert_to_foster |
}; # $insert_to_foster |
| 3720 |
|
|
| 3721 |
B: { |
B: while (1) { |
| 3722 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
| 3723 |
!!!cp ('t73'); |
!!!cp ('t73'); |
| 3724 |
!!!parse-error (type => 'DOCTYPE in the middle', token => $token); |
!!!parse-error (type => 'DOCTYPE in the middle', token => $token); |
| 3725 |
## Ignore the token |
## Ignore the token |
| 3726 |
## Stay in the phase |
## Stay in the phase |
| 3727 |
!!!next-token; |
!!!next-token; |
| 3728 |
redo B; |
next B; |
| 3729 |
} elsif ($token->{type} == START_TAG_TOKEN and |
} elsif ($token->{type} == START_TAG_TOKEN and |
| 3730 |
$token->{tag_name} eq 'html') { |
$token->{tag_name} eq 'html') { |
| 3731 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
| 3751 |
$token->{attributes}->{$attr_name}->{value}); |
$token->{attributes}->{$attr_name}->{value}); |
| 3752 |
} |
} |
| 3753 |
} |
} |
| 3754 |
|
!!!nack ('t84.1'); |
| 3755 |
!!!next-token; |
!!!next-token; |
| 3756 |
redo B; |
next B; |
| 3757 |
} elsif ($token->{type} == COMMENT_TOKEN) { |
} elsif ($token->{type} == COMMENT_TOKEN) { |
| 3758 |
my $comment = $self->{document}->create_comment ($token->{data}); |
my $comment = $self->{document}->create_comment ($token->{data}); |
| 3759 |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
| 3767 |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
| 3768 |
} |
} |
| 3769 |
!!!next-token; |
!!!next-token; |
| 3770 |
redo B; |
next B; |
| 3771 |
} elsif ($self->{insertion_mode} & HEAD_IMS) { |
} elsif ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM) { |
| 3772 |
|
if ($token->{type} == CHARACTER_TOKEN) { |
| 3773 |
|
!!!cp ('t87.1'); |
| 3774 |
|
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 3775 |
|
!!!next-token; |
| 3776 |
|
next B; |
| 3777 |
|
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 3778 |
|
if ((not {mglyph => 1, malignmark => 1}->{$token->{tag_name}} and |
| 3779 |
|
$self->{open_elements}->[-1]->[1] & FOREIGN_FLOW_CONTENT_EL) or |
| 3780 |
|
not ($self->{open_elements}->[-1]->[1] & FOREIGN_EL) or |
| 3781 |
|
($token->{tag_name} eq 'svg' and |
| 3782 |
|
$self->{open_elements}->[-1]->[1] & MML_AXML_EL)) { |
| 3783 |
|
## NOTE: "using the rules for secondary insertion mode"then"continue" |
| 3784 |
|
!!!cp ('t87.2'); |
| 3785 |
|
# |
| 3786 |
|
} elsif ({ |
| 3787 |
|
b => 1, big => 1, blockquote => 1, body => 1, br => 1, |
| 3788 |
|
center => 1, code => 1, dd => 1, div => 1, dl => 1, em => 1, |
| 3789 |
|
embed => 1, font => 1, h1 => 1, h2 => 1, h3 => 1, ## No h4! |
| 3790 |
|
h5 => 1, h6 => 1, head => 1, hr => 1, i => 1, img => 1, |
| 3791 |
|
li => 1, menu => 1, meta => 1, nobr => 1, p => 1, pre => 1, |
| 3792 |
|
ruby => 1, s => 1, small => 1, span => 1, strong => 1, |
| 3793 |
|
sub => 1, sup => 1, table => 1, tt => 1, u => 1, ul => 1, |
| 3794 |
|
var => 1, |
| 3795 |
|
}->{$token->{tag_name}}) { |
| 3796 |
|
!!!cp ('t87.2'); |
| 3797 |
|
!!!parse-error (type => 'not closed', |
| 3798 |
|
value => $self->{open_elements}->[-1]->[0] |
| 3799 |
|
->manakai_local_name, |
| 3800 |
|
token => $token); |
| 3801 |
|
|
| 3802 |
|
pop @{$self->{open_elements}} |
| 3803 |
|
while $self->{open_elements}->[-1]->[1] & FOREIGN_EL; |
| 3804 |
|
|
| 3805 |
|
$self->{insertion_mode} &= ~ IN_FOREIGN_CONTENT_IM; |
| 3806 |
|
## Reprocess. |
| 3807 |
|
next B; |
| 3808 |
|
} else { |
| 3809 |
|
my $nsuri = $self->{open_elements}->[-1]->[0]->namespace_uri; |
| 3810 |
|
my $tag_name = $token->{tag_name}; |
| 3811 |
|
if ($nsuri eq $SVG_NS) { |
| 3812 |
|
$tag_name = { |
| 3813 |
|
altglyph => 'altGlyph', |
| 3814 |
|
altglyphdef => 'altGlyphDef', |
| 3815 |
|
altglyphitem => 'altGlyphItem', |
| 3816 |
|
animatecolor => 'animateColor', |
| 3817 |
|
animatemotion => 'animateMotion', |
| 3818 |
|
animatetransform => 'animateTransform', |
| 3819 |
|
clippath => 'clipPath', |
| 3820 |
|
feblend => 'feBlend', |
| 3821 |
|
fecolormatrix => 'feColorMatrix', |
| 3822 |
|
fecomponenttransfer => 'feComponentTransfer', |
| 3823 |
|
fecomposite => 'feComposite', |
| 3824 |
|
feconvolvematrix => 'feConvolveMatrix', |
| 3825 |
|
fediffuselighting => 'feDiffuseLighting', |
| 3826 |
|
fedisplacementmap => 'feDisplacementMap', |
| 3827 |
|
fedistantlight => 'feDistantLight', |
| 3828 |
|
feflood => 'feFlood', |
| 3829 |
|
fefunca => 'feFuncA', |
| 3830 |
|
fefuncb => 'feFuncB', |
| 3831 |
|
fefuncg => 'feFuncG', |
| 3832 |
|
fefuncr => 'feFuncR', |
| 3833 |
|
fegaussianblur => 'feGaussianBlur', |
| 3834 |
|
feimage => 'feImage', |
| 3835 |
|
femerge => 'feMerge', |
| 3836 |
|
femergenode => 'feMergeNode', |
| 3837 |
|
femorphology => 'feMorphology', |
| 3838 |
|
feoffset => 'feOffset', |
| 3839 |
|
fepointlight => 'fePointLight', |
| 3840 |
|
fespecularlighting => 'feSpecularLighting', |
| 3841 |
|
fespotlight => 'feSpotLight', |
| 3842 |
|
fetile => 'feTile', |
| 3843 |
|
feturbulence => 'feTurbulence', |
| 3844 |
|
foreignobject => 'foreignObject', |
| 3845 |
|
glyphref => 'glyphRef', |
| 3846 |
|
lineargradient => 'linearGradient', |
| 3847 |
|
radialgradient => 'radialGradient', |
| 3848 |
|
#solidcolor => 'solidColor', ## NOTE: Commented in spec (SVG1.2) |
| 3849 |
|
textpath => 'textPath', |
| 3850 |
|
}->{$tag_name} || $tag_name; |
| 3851 |
|
} |
| 3852 |
|
|
| 3853 |
|
## "adjust SVG attributes" (SVG only) - done in insert-element-f |
| 3854 |
|
|
| 3855 |
|
## "adjust foreign attributes" - done in insert-element-f |
| 3856 |
|
|
| 3857 |
|
!!!insert-element-f ($nsuri, $tag_name, $token->{attributes}, $token); |
| 3858 |
|
|
| 3859 |
|
if ($self->{self_closing}) { |
| 3860 |
|
pop @{$self->{open_elements}}; |
| 3861 |
|
!!!ack ('t87.3'); |
| 3862 |
|
} else { |
| 3863 |
|
!!!cp ('t87.4'); |
| 3864 |
|
} |
| 3865 |
|
|
| 3866 |
|
!!!next-token; |
| 3867 |
|
next B; |
| 3868 |
|
} |
| 3869 |
|
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 3870 |
|
## NOTE: "using the rules for secondary insertion mode" then "continue" |
| 3871 |
|
!!!cp ('t87.5'); |
| 3872 |
|
# |
| 3873 |
|
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 3874 |
|
## NOTE: "using the rules for secondary insertion mode" then "continue" |
| 3875 |
|
!!!cp ('t87.6'); |
| 3876 |
|
# |
| 3877 |
|
## TODO: ... |
| 3878 |
|
} else { |
| 3879 |
|
die "$0: $token->{type}: Unknown token type"; |
| 3880 |
|
} |
| 3881 |
|
} |
| 3882 |
|
|
| 3883 |
|
if ($self->{insertion_mode} & HEAD_IMS) { |
| 3884 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 3885 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
| 3886 |
unless ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
unless ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3890 |
!!!cp ('t88.1'); |
!!!cp ('t88.1'); |
| 3891 |
## Ignore the token. |
## Ignore the token. |
| 3892 |
!!!next-token; |
!!!next-token; |
| 3893 |
redo B; |
next B; |
| 3894 |
} |
} |
| 3895 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 3896 |
!!!cp ('t88'); |
!!!cp ('t88'); |
| 3897 |
!!!next-token; |
!!!next-token; |
| 3898 |
redo B; |
next B; |
| 3899 |
} |
} |
| 3900 |
} |
} |
| 3901 |
|
|
| 3902 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3903 |
!!!cp ('t89'); |
!!!cp ('t89'); |
| 3904 |
## As if <head> |
## As if <head> |
| 3905 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 3906 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 3907 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 3908 |
|
[$self->{head_element}, $el_category->{head}]; |
| 3909 |
|
|
| 3910 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
| 3911 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 3931 |
!!!cp ('t92'); |
!!!cp ('t92'); |
| 3932 |
} |
} |
| 3933 |
|
|
| 3934 |
## "after head" insertion mode |
## "after head" insertion mode |
| 3935 |
## As if <body> |
## As if <body> |
| 3936 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 3937 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 3938 |
## reprocess |
## reprocess |
| 3939 |
redo B; |
next B; |
| 3940 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 3941 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
| 3942 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3943 |
!!!cp ('t93'); |
!!!cp ('t93'); |
| 3944 |
!!!create-element ($self->{head_element}, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
| 3945 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child |
| 3946 |
push @{$self->{open_elements}}, [$self->{head_element}, $token->{tag_name}]; |
($self->{head_element}); |
| 3947 |
$self->{insertion_mode} = IN_HEAD_IM; |
push @{$self->{open_elements}}, |
| 3948 |
!!!next-token; |
[$self->{head_element}, $el_category->{head}]; |
| 3949 |
redo B; |
$self->{insertion_mode} = IN_HEAD_IM; |
| 3950 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
!!!nack ('t93.1'); |
| 3951 |
!!!cp ('t94'); |
!!!next-token; |
| 3952 |
# |
next B; |
| 3953 |
} else { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 3954 |
!!!cp ('t95'); |
!!!cp ('t94'); |
| 3955 |
!!!parse-error (type => 'in head:head', token => $token); # or in head noscript |
# |
| 3956 |
## Ignore the token |
} else { |
| 3957 |
!!!next-token; |
!!!cp ('t95'); |
| 3958 |
redo B; |
!!!parse-error (type => 'in head:head', token => $token); # or in head noscript |
| 3959 |
} |
## Ignore the token |
| 3960 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
!!!nack ('t95.1'); |
| 3961 |
!!!cp ('t96'); |
!!!next-token; |
| 3962 |
## As if <head> |
next B; |
| 3963 |
!!!create-element ($self->{head_element}, 'head',, $token); |
} |
| 3964 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 3965 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
!!!cp ('t96'); |
| 3966 |
|
## As if <head> |
| 3967 |
|
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 3968 |
|
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 3969 |
|
push @{$self->{open_elements}}, |
| 3970 |
|
[$self->{head_element}, $el_category->{head}]; |
| 3971 |
|
|
| 3972 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
| 3973 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
| 3974 |
} else { |
} else { |
| 3975 |
!!!cp ('t97'); |
!!!cp ('t97'); |
| 3976 |
} |
} |
| 3977 |
|
|
| 3978 |
if ($token->{tag_name} eq 'base') { |
if ($token->{tag_name} eq 'base') { |
| 3979 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 3992 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 3993 |
!!!cp ('t100'); |
!!!cp ('t100'); |
| 3994 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
| 3995 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 3996 |
|
[$self->{head_element}, $el_category->{head}]; |
| 3997 |
} else { |
} else { |
| 3998 |
!!!cp ('t101'); |
!!!cp ('t101'); |
| 3999 |
} |
} |
| 4001 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
| 4002 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 4003 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 4004 |
|
!!!nack ('t101.1'); |
| 4005 |
!!!next-token; |
!!!next-token; |
| 4006 |
redo B; |
next B; |
| 4007 |
} elsif ($token->{tag_name} eq 'link') { |
} elsif ($token->{tag_name} eq 'link') { |
| 4008 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
| 4009 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 4010 |
!!!cp ('t102'); |
!!!cp ('t102'); |
| 4011 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
| 4012 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 4013 |
|
[$self->{head_element}, $el_category->{head}]; |
| 4014 |
} else { |
} else { |
| 4015 |
!!!cp ('t103'); |
!!!cp ('t103'); |
| 4016 |
} |
} |
| 4018 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
| 4019 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 4020 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 4021 |
|
!!!ack ('t103.1'); |
| 4022 |
!!!next-token; |
!!!next-token; |
| 4023 |
redo B; |
next B; |
| 4024 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
| 4025 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
| 4026 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 4027 |
!!!cp ('t104'); |
!!!cp ('t104'); |
| 4028 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
| 4029 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 4030 |
|
[$self->{head_element}, $el_category->{head}]; |
| 4031 |
} else { |
} else { |
| 4032 |
!!!cp ('t105'); |
!!!cp ('t105'); |
| 4033 |
} |
} |
| 4083 |
|
|
| 4084 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 4085 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 4086 |
|
!!!ack ('t110.1'); |
| 4087 |
!!!next-token; |
!!!next-token; |
| 4088 |
redo B; |
next B; |
| 4089 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
| 4090 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 4091 |
!!!cp ('t111'); |
!!!cp ('t111'); |
| 4098 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 4099 |
!!!cp ('t112'); |
!!!cp ('t112'); |
| 4100 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
| 4101 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 4102 |
|
[$self->{head_element}, $el_category->{head}]; |
| 4103 |
} else { |
} else { |
| 4104 |
!!!cp ('t113'); |
!!!cp ('t113'); |
| 4105 |
} |
} |
| 4110 |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
| 4111 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 4112 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 4113 |
redo B; |
next B; |
| 4114 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
| 4115 |
## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and |
## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and |
| 4116 |
## insertion mode IN_HEAD_IM) |
## insertion mode IN_HEAD_IM) |
| 4118 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 4119 |
!!!cp ('t114'); |
!!!cp ('t114'); |
| 4120 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
| 4121 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 4122 |
|
[$self->{head_element}, $el_category->{head}]; |
| 4123 |
} else { |
} else { |
| 4124 |
!!!cp ('t115'); |
!!!cp ('t115'); |
| 4125 |
} |
} |
| 4126 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 4127 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 4128 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 4129 |
redo B; |
next B; |
| 4130 |
} elsif ($token->{tag_name} eq 'noscript') { |
} elsif ($token->{tag_name} eq 'noscript') { |
| 4131 |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
| 4132 |
!!!cp ('t116'); |
!!!cp ('t116'); |
| 4133 |
## NOTE: and scripting is disalbed |
## NOTE: and scripting is disalbed |
| 4134 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 4135 |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
| 4136 |
|
!!!nack ('t116.1'); |
| 4137 |
!!!next-token; |
!!!next-token; |
| 4138 |
redo B; |
next B; |
| 4139 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 4140 |
!!!cp ('t117'); |
!!!cp ('t117'); |
| 4141 |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
| 4142 |
## Ignore the token |
## Ignore the token |
| 4143 |
|
!!!nack ('t117.1'); |
| 4144 |
!!!next-token; |
!!!next-token; |
| 4145 |
redo B; |
next B; |
| 4146 |
} else { |
} else { |
| 4147 |
!!!cp ('t118'); |
!!!cp ('t118'); |
| 4148 |
# |
# |
| 4159 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
| 4160 |
!!!cp ('t120'); |
!!!cp ('t120'); |
| 4161 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
| 4162 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 4163 |
|
[$self->{head_element}, $el_category->{head}]; |
| 4164 |
} else { |
} else { |
| 4165 |
!!!cp ('t121'); |
!!!cp ('t121'); |
| 4166 |
} |
} |
| 4169 |
$script_start_tag->(); |
$script_start_tag->(); |
| 4170 |
pop @{$self->{open_elements}} # <head> |
pop @{$self->{open_elements}} # <head> |
| 4171 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
| 4172 |
redo B; |
next B; |
| 4173 |
} elsif ($token->{tag_name} eq 'body' or |
} elsif ($token->{tag_name} eq 'body' or |
| 4174 |
$token->{tag_name} eq 'frameset') { |
$token->{tag_name} eq 'frameset') { |
| 4175 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 4203 |
} else { |
} else { |
| 4204 |
die "$0: tag name: $self->{tag_name}"; |
die "$0: tag name: $self->{tag_name}"; |
| 4205 |
} |
} |
| 4206 |
|
!!!nack ('t127.1'); |
| 4207 |
!!!next-token; |
!!!next-token; |
| 4208 |
redo B; |
next B; |
| 4209 |
} else { |
} else { |
| 4210 |
!!!cp ('t128'); |
!!!cp ('t128'); |
| 4211 |
# |
# |
| 4237 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 4238 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 4239 |
## reprocess |
## reprocess |
| 4240 |
redo B; |
!!!ack-later; |
| 4241 |
|
next B; |
| 4242 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 4243 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
| 4244 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4245 |
!!!cp ('t132'); |
!!!cp ('t132'); |
| 4246 |
## As if <head> |
## As if <head> |
| 4247 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 4248 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 4249 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 4250 |
|
[$self->{head_element}, $el_category->{head}]; |
| 4251 |
|
|
| 4252 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
| 4253 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4254 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
| 4255 |
!!!next-token; |
!!!next-token; |
| 4256 |
redo B; |
next B; |
| 4257 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
| 4258 |
!!!cp ('t133'); |
!!!cp ('t133'); |
| 4259 |
## As if </noscript> |
## As if </noscript> |
| 4264 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4265 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
| 4266 |
!!!next-token; |
!!!next-token; |
| 4267 |
redo B; |
next B; |
| 4268 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
| 4269 |
!!!cp ('t134'); |
!!!cp ('t134'); |
| 4270 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4271 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
| 4272 |
!!!next-token; |
!!!next-token; |
| 4273 |
redo B; |
next B; |
| 4274 |
} else { |
} else { |
| 4275 |
!!!cp ('t135'); |
!!!cp ('t135'); |
| 4276 |
# |
# |
| 4281 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4282 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
| 4283 |
!!!next-token; |
!!!next-token; |
| 4284 |
redo B; |
next B; |
| 4285 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4286 |
!!!cp ('t137'); |
!!!cp ('t137'); |
| 4287 |
!!!parse-error (type => 'unmatched end tag:noscript', token => $token); |
!!!parse-error (type => 'unmatched end tag:noscript', token => $token); |
| 4288 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
| 4289 |
!!!next-token; |
!!!next-token; |
| 4290 |
redo B; |
next B; |
| 4291 |
} else { |
} else { |
| 4292 |
!!!cp ('t138'); |
!!!cp ('t138'); |
| 4293 |
# |
# |
| 4298 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4299 |
!!!cp ('t139'); |
!!!cp ('t139'); |
| 4300 |
## As if <head> |
## As if <head> |
| 4301 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 4302 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 4303 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 4304 |
|
[$self->{head_element}, $el_category->{head}]; |
| 4305 |
|
|
| 4306 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
| 4307 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
| 4310 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4311 |
## Ignore the token |
## Ignore the token |
| 4312 |
!!!next-token; |
!!!next-token; |
| 4313 |
redo B; |
next B; |
| 4314 |
} else { |
} else { |
| 4315 |
!!!cp ('t141'); |
!!!cp ('t141'); |
| 4316 |
} |
} |
| 4322 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4323 |
!!!cp ('t142'); |
!!!cp ('t142'); |
| 4324 |
## As if <head> |
## As if <head> |
| 4325 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 4326 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 4327 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, |
| 4328 |
|
[$self->{head_element}, $el_category->{head}]; |
| 4329 |
|
|
| 4330 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
| 4331 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
| 4343 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4344 |
## Ignore the token |
## Ignore the token |
| 4345 |
!!!next-token; |
!!!next-token; |
| 4346 |
redo B; |
next B; |
| 4347 |
} |
} |
| 4348 |
} |
} |
| 4349 |
|
|
| 4370 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4371 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
| 4372 |
!!!next-token; |
!!!next-token; |
| 4373 |
redo B; |
next B; |
| 4374 |
} else { |
} else { |
| 4375 |
!!!cp ('t149'); |
!!!cp ('t149'); |
| 4376 |
} |
} |
| 4380 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 4381 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 4382 |
## reprocess |
## reprocess |
| 4383 |
redo B; |
next B; |
| 4384 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 4385 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
| 4386 |
!!!cp ('t149.1'); |
!!!cp ('t149.1'); |
| 4387 |
|
|
| 4388 |
## NOTE: As if <head> |
## NOTE: As if <head> |
| 4389 |
!!!create-element ($self->{head_element}, 'head',, $token); |
!!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token); |
| 4390 |
$self->{open_elements}->[-1]->[0]->append_child |
$self->{open_elements}->[-1]->[0]->append_child |
| 4391 |
($self->{head_element}); |
($self->{head_element}); |
| 4392 |
#push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
#push @{$self->{open_elements}}, |
| 4393 |
|
# [$self->{head_element}, $el_category->{head}]; |
| 4394 |
#$self->{insertion_mode} = IN_HEAD_IM; |
#$self->{insertion_mode} = IN_HEAD_IM; |
| 4395 |
## NOTE: Reprocess. |
## NOTE: Reprocess. |
| 4396 |
|
|
| 4434 |
!!!insert-element ('body',, $token); |
!!!insert-element ('body',, $token); |
| 4435 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 4436 |
## NOTE: Reprocess. |
## NOTE: Reprocess. |
| 4437 |
redo B; |
next B; |
| 4438 |
} else { |
} else { |
| 4439 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 4440 |
} |
} |
| 4449 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 4450 |
|
|
| 4451 |
!!!next-token; |
!!!next-token; |
| 4452 |
redo B; |
next B; |
| 4453 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 4454 |
if ({ |
if ({ |
| 4455 |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
| 4459 |
## have an element in table scope |
## have an element in table scope |
| 4460 |
for (reverse 0..$#{$self->{open_elements}}) { |
for (reverse 0..$#{$self->{open_elements}}) { |
| 4461 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4462 |
if ($node->[1] eq 'td' or $node->[1] eq 'th') { |
if ($node->[1] & TABLE_CELL_EL) { |
| 4463 |
!!!cp ('t151'); |
!!!cp ('t151'); |
| 4464 |
|
|
| 4465 |
## Close the cell |
## Close the cell |
| 4466 |
!!!back-token; # <?> |
!!!back-token; # <x> |
| 4467 |
$token = {type => END_TAG_TOKEN, tag_name => $node->[1], |
$token = {type => END_TAG_TOKEN, |
| 4468 |
|
tag_name => $node->[0]->manakai_local_name, |
| 4469 |
line => $token->{line}, |
line => $token->{line}, |
| 4470 |
column => $token->{column}}; |
column => $token->{column}}; |
| 4471 |
redo B; |
next B; |
| 4472 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 4473 |
!!!cp ('t152'); |
!!!cp ('t152'); |
| 4474 |
## ISSUE: This case can never be reached, maybe. |
## ISSUE: This case can never be reached, maybe. |
| 4475 |
last; |
last; |
| 4480 |
!!!parse-error (type => 'start tag not allowed', |
!!!parse-error (type => 'start tag not allowed', |
| 4481 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
| 4482 |
## Ignore the token |
## Ignore the token |
| 4483 |
|
!!!nack ('t153.1'); |
| 4484 |
!!!next-token; |
!!!next-token; |
| 4485 |
redo B; |
next B; |
| 4486 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
| 4487 |
!!!parse-error (type => 'not closed:caption', token => $token); |
!!!parse-error (type => 'not closed:caption', token => $token); |
| 4488 |
|
|
| 4492 |
INSCOPE: { |
INSCOPE: { |
| 4493 |
for (reverse 0..$#{$self->{open_elements}}) { |
for (reverse 0..$#{$self->{open_elements}}) { |
| 4494 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4495 |
if ($node->[1] eq 'caption') { |
if ($node->[1] & CAPTION_EL) { |
| 4496 |
!!!cp ('t155'); |
!!!cp ('t155'); |
| 4497 |
$i = $_; |
$i = $_; |
| 4498 |
last INSCOPE; |
last INSCOPE; |
| 4499 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 4500 |
!!!cp ('t156'); |
!!!cp ('t156'); |
| 4501 |
last; |
last; |
| 4502 |
} |
} |
| 4506 |
!!!parse-error (type => 'start tag not allowed', |
!!!parse-error (type => 'start tag not allowed', |
| 4507 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
| 4508 |
## Ignore the token |
## Ignore the token |
| 4509 |
|
!!!nack ('t157.1'); |
| 4510 |
!!!next-token; |
!!!next-token; |
| 4511 |
redo B; |
next B; |
| 4512 |
} # INSCOPE |
} # INSCOPE |
| 4513 |
|
|
| 4514 |
## generate implied end tags |
## generate implied end tags |
| 4515 |
while ({ |
while ($self->{open_elements}->[-1]->[1] |
| 4516 |
dd => 1, dt => 1, li => 1, p => 1, |
& END_TAG_OPTIONAL_EL) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 4517 |
!!!cp ('t158'); |
!!!cp ('t158'); |
| 4518 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4519 |
} |
} |
| 4520 |
|
|
| 4521 |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
| 4522 |
!!!cp ('t159'); |
!!!cp ('t159'); |
| 4523 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 4524 |
|
value => $self->{open_elements}->[-1]->[0] |
| 4525 |
|
->manakai_local_name, |
| 4526 |
|
token => $token); |
| 4527 |
} else { |
} else { |
| 4528 |
!!!cp ('t160'); |
!!!cp ('t160'); |
| 4529 |
} |
} |
| 4535 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 4536 |
|
|
| 4537 |
## reprocess |
## reprocess |
| 4538 |
redo B; |
!!!ack-later; |
| 4539 |
|
next B; |
| 4540 |
} else { |
} else { |
| 4541 |
!!!cp ('t161'); |
!!!cp ('t161'); |
| 4542 |
# |
# |
| 4552 |
my $i; |
my $i; |
| 4553 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 4554 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4555 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[0]->manakai_local_name eq $token->{tag_name}) { |
| 4556 |
!!!cp ('t163'); |
!!!cp ('t163'); |
| 4557 |
$i = $_; |
$i = $_; |
| 4558 |
last INSCOPE; |
last INSCOPE; |
| 4559 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 4560 |
!!!cp ('t164'); |
!!!cp ('t164'); |
| 4561 |
last INSCOPE; |
last INSCOPE; |
| 4562 |
} |
} |
| 4566 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4567 |
## Ignore the token |
## Ignore the token |
| 4568 |
!!!next-token; |
!!!next-token; |
| 4569 |
redo B; |
next B; |
| 4570 |
} |
} |
| 4571 |
|
|
| 4572 |
## generate implied end tags |
## generate implied end tags |
| 4573 |
while ({ |
while ($self->{open_elements}->[-1]->[1] |
| 4574 |
dd => 1, dt => 1, li => 1, p => 1, |
& END_TAG_OPTIONAL_EL) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 4575 |
!!!cp ('t166'); |
!!!cp ('t166'); |
| 4576 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4577 |
} |
} |
| 4578 |
|
|
| 4579 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
| 4580 |
|
ne $token->{tag_name}) { |
| 4581 |
!!!cp ('t167'); |
!!!cp ('t167'); |
| 4582 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 4583 |
|
value => $self->{open_elements}->[-1]->[0] |
| 4584 |
|
->manakai_local_name, |
| 4585 |
|
token => $token); |
| 4586 |
} else { |
} else { |
| 4587 |
!!!cp ('t168'); |
!!!cp ('t168'); |
| 4588 |
} |
} |
| 4594 |
$self->{insertion_mode} = IN_ROW_IM; |
$self->{insertion_mode} = IN_ROW_IM; |
| 4595 |
|
|
| 4596 |
!!!next-token; |
!!!next-token; |
| 4597 |
redo B; |
next B; |
| 4598 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
| 4599 |
!!!cp ('t169'); |
!!!cp ('t169'); |
| 4600 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4601 |
## Ignore the token |
## Ignore the token |
| 4602 |
!!!next-token; |
!!!next-token; |
| 4603 |
redo B; |
next B; |
| 4604 |
} else { |
} else { |
| 4605 |
!!!cp ('t170'); |
!!!cp ('t170'); |
| 4606 |
# |
# |
| 4612 |
INSCOPE: { |
INSCOPE: { |
| 4613 |
for (reverse 0..$#{$self->{open_elements}}) { |
for (reverse 0..$#{$self->{open_elements}}) { |
| 4614 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4615 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] & CAPTION_EL) { |
| 4616 |
!!!cp ('t171'); |
!!!cp ('t171'); |
| 4617 |
$i = $_; |
$i = $_; |
| 4618 |
last INSCOPE; |
last INSCOPE; |
| 4619 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 4620 |
!!!cp ('t172'); |
!!!cp ('t172'); |
| 4621 |
last; |
last; |
| 4622 |
} |
} |
| 4627 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
| 4628 |
## Ignore the token |
## Ignore the token |
| 4629 |
!!!next-token; |
!!!next-token; |
| 4630 |
redo B; |
next B; |
| 4631 |
} # INSCOPE |
} # INSCOPE |
| 4632 |
|
|
| 4633 |
## generate implied end tags |
## generate implied end tags |
| 4634 |
while ({ |
while ($self->{open_elements}->[-1]->[1] |
| 4635 |
dd => 1, dt => 1, li => 1, p => 1, |
& END_TAG_OPTIONAL_EL) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 4636 |
!!!cp ('t174'); |
!!!cp ('t174'); |
| 4637 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4638 |
} |
} |
| 4639 |
|
|
| 4640 |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
| 4641 |
!!!cp ('t175'); |
!!!cp ('t175'); |
| 4642 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 4643 |
|
value => $self->{open_elements}->[-1]->[0] |
| 4644 |
|
->manakai_local_name, |
| 4645 |
|
token => $token); |
| 4646 |
} else { |
} else { |
| 4647 |
!!!cp ('t176'); |
!!!cp ('t176'); |
| 4648 |
} |
} |
| 4654 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 4655 |
|
|
| 4656 |
!!!next-token; |
!!!next-token; |
| 4657 |
redo B; |
next B; |
| 4658 |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
| 4659 |
!!!cp ('t177'); |
!!!cp ('t177'); |
| 4660 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4661 |
## Ignore the token |
## Ignore the token |
| 4662 |
!!!next-token; |
!!!next-token; |
| 4663 |
redo B; |
next B; |
| 4664 |
} else { |
} else { |
| 4665 |
!!!cp ('t178'); |
!!!cp ('t178'); |
| 4666 |
# |
# |
| 4676 |
INSCOPE: { |
INSCOPE: { |
| 4677 |
for (reverse 0..$#{$self->{open_elements}}) { |
for (reverse 0..$#{$self->{open_elements}}) { |
| 4678 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4679 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[0]->manakai_local_name eq $token->{tag_name}) { |
| 4680 |
!!!cp ('t179'); |
!!!cp ('t179'); |
| 4681 |
$i = $_; |
$i = $_; |
| 4682 |
|
|
| 4683 |
## Close the cell |
## Close the cell |
| 4684 |
!!!back-token; # </?> |
!!!back-token; # </x> |
| 4685 |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
$token = {type => END_TAG_TOKEN, tag_name => $tn, |
| 4686 |
line => $token->{line}, |
line => $token->{line}, |
| 4687 |
column => $token->{column}}; |
column => $token->{column}}; |
| 4688 |
redo B; |
next B; |
| 4689 |
} elsif ($node->[1] eq 'td' or $node->[1] eq 'th') { |
} elsif ($node->[1] & TABLE_CELL_EL) { |
| 4690 |
!!!cp ('t180'); |
!!!cp ('t180'); |
| 4691 |
$tn = $node->[1]; |
$tn = $node->[0]->manakai_local_name; |
| 4692 |
## NOTE: There is exactly one |td| or |th| element |
## NOTE: There is exactly one |td| or |th| element |
| 4693 |
## in scope in the stack of open elements by definition. |
## in scope in the stack of open elements by definition. |
| 4694 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 4695 |
## ISSUE: Can this be reached? |
## ISSUE: Can this be reached? |
| 4696 |
!!!cp ('t181'); |
!!!cp ('t181'); |
| 4697 |
last; |
last; |
| 4703 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
| 4704 |
## Ignore the token |
## Ignore the token |
| 4705 |
!!!next-token; |
!!!next-token; |
| 4706 |
redo B; |
next B; |
| 4707 |
} # INSCOPE |
} # INSCOPE |
| 4708 |
} elsif ($token->{tag_name} eq 'table' and |
} elsif ($token->{tag_name} eq 'table' and |
| 4709 |
$self->{insertion_mode} == IN_CAPTION_IM) { |
$self->{insertion_mode} == IN_CAPTION_IM) { |
| 4714 |
my $i; |
my $i; |
| 4715 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 4716 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4717 |
if ($node->[1] eq 'caption') { |
if ($node->[1] & CAPTION_EL) { |
| 4718 |
!!!cp ('t184'); |
!!!cp ('t184'); |
| 4719 |
$i = $_; |
$i = $_; |
| 4720 |
last INSCOPE; |
last INSCOPE; |
| 4721 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 4722 |
!!!cp ('t185'); |
!!!cp ('t185'); |
| 4723 |
last INSCOPE; |
last INSCOPE; |
| 4724 |
} |
} |
| 4728 |
!!!parse-error (type => 'unmatched end tag:caption', token => $token); |
!!!parse-error (type => 'unmatched end tag:caption', token => $token); |
| 4729 |
## Ignore the token |
## Ignore the token |
| 4730 |
!!!next-token; |
!!!next-token; |
| 4731 |
redo B; |
next B; |
| 4732 |
} |
} |
| 4733 |
|
|
| 4734 |
## generate implied end tags |
## generate implied end tags |
| 4735 |
while ({ |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
|
dd => 1, dt => 1, li => 1, p => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 4736 |
!!!cp ('t187'); |
!!!cp ('t187'); |
| 4737 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4738 |
} |
} |
| 4739 |
|
|
| 4740 |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
| 4741 |
!!!cp ('t188'); |
!!!cp ('t188'); |
| 4742 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 4743 |
|
value => $self->{open_elements}->[-1]->[0] |
| 4744 |
|
->manakai_local_name, |
| 4745 |
|
token => $token); |
| 4746 |
} else { |
} else { |
| 4747 |
!!!cp ('t189'); |
!!!cp ('t189'); |
| 4748 |
} |
} |
| 4754 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 4755 |
|
|
| 4756 |
## reprocess |
## reprocess |
| 4757 |
redo B; |
next B; |
| 4758 |
} elsif ({ |
} elsif ({ |
| 4759 |
body => 1, col => 1, colgroup => 1, html => 1, |
body => 1, col => 1, colgroup => 1, html => 1, |
| 4760 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 4763 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4764 |
## Ignore the token |
## Ignore the token |
| 4765 |
!!!next-token; |
!!!next-token; |
| 4766 |
redo B; |
next B; |
| 4767 |
} else { |
} else { |
| 4768 |
!!!cp ('t191'); |
!!!cp ('t191'); |
| 4769 |
# |
# |
| 4777 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4778 |
## Ignore the token |
## Ignore the token |
| 4779 |
!!!next-token; |
!!!next-token; |
| 4780 |
redo B; |
next B; |
| 4781 |
} else { |
} else { |
| 4782 |
!!!cp ('t193'); |
!!!cp ('t193'); |
| 4783 |
# |
# |
| 4784 |
} |
} |
| 4785 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 4786 |
for my $entry (@{$self->{open_elements}}) { |
for my $entry (@{$self->{open_elements}}) { |
| 4787 |
if (not { |
unless ($entry->[1] & ALL_END_TAG_OPTIONAL_EL) { |
|
dd => 1, dt => 1, li => 1, p => 1, tbody => 1, td => 1, tfoot => 1, |
|
|
th => 1, thead => 1, tr => 1, body => 1, html => 1, |
|
|
}->{$entry->[1]}) { |
|
| 4788 |
!!!cp ('t75'); |
!!!cp ('t75'); |
| 4789 |
!!!parse-error (type => 'in body:#eof', token => $token); |
!!!parse-error (type => 'in body:#eof', token => $token); |
| 4790 |
last; |
last; |
| 4808 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 4809 |
!!!cp ('t194'); |
!!!cp ('t194'); |
| 4810 |
!!!next-token; |
!!!next-token; |
| 4811 |
redo B; |
next B; |
| 4812 |
} else { |
} else { |
| 4813 |
!!!cp ('t195'); |
!!!cp ('t195'); |
| 4814 |
} |
} |
| 4822 |
## result in a new Text node. |
## result in a new Text node. |
| 4823 |
$reconstruct_active_formatting_elements->($insert_to_foster); |
$reconstruct_active_formatting_elements->($insert_to_foster); |
| 4824 |
|
|
| 4825 |
if ({ |
if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) { |
|
table => 1, tbody => 1, tfoot => 1, |
|
|
thead => 1, tr => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 4826 |
# MUST |
# MUST |
| 4827 |
my $foster_parent_element; |
my $foster_parent_element; |
| 4828 |
my $next_sibling; |
my $next_sibling; |
| 4829 |
my $prev_sibling; |
my $prev_sibling; |
| 4830 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
| 4831 |
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
if ($self->{open_elements}->[$_]->[1] & TABLE_EL) { |
| 4832 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
| 4833 |
if (defined $parent and $parent->node_type == 1) { |
if (defined $parent and $parent->node_type == 1) { |
| 4834 |
!!!cp ('t196'); |
!!!cp ('t196'); |
| 4863 |
} |
} |
| 4864 |
|
|
| 4865 |
!!!next-token; |
!!!next-token; |
| 4866 |
redo B; |
next B; |
| 4867 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 4868 |
if ({ |
if ({ |
| 4869 |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
| 4871 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 4872 |
if ($self->{insertion_mode} == IN_TABLE_IM) { |
if ($self->{insertion_mode} == IN_TABLE_IM) { |
| 4873 |
## Clear back to table context |
## Clear back to table context |
| 4874 |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
while (not ($self->{open_elements}->[-1]->[1] |
| 4875 |
$self->{open_elements}->[-1]->[1] ne 'html') { |
& TABLE_SCOPING_EL)) { |
| 4876 |
!!!cp ('t201'); |
!!!cp ('t201'); |
| 4877 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4878 |
} |
} |
| 4889 |
} |
} |
| 4890 |
|
|
| 4891 |
## Clear back to table body context |
## Clear back to table body context |
| 4892 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 4893 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
& TABLE_ROWS_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 4894 |
!!!cp ('t203'); |
!!!cp ('t203'); |
| 4895 |
## ISSUE: Can this case be reached? |
## ISSUE: Can this case be reached? |
| 4896 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4900 |
if ($token->{tag_name} eq 'tr') { |
if ($token->{tag_name} eq 'tr') { |
| 4901 |
!!!cp ('t204'); |
!!!cp ('t204'); |
| 4902 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 4903 |
|
!!!nack ('t204'); |
| 4904 |
!!!next-token; |
!!!next-token; |
| 4905 |
redo B; |
next B; |
| 4906 |
} else { |
} else { |
| 4907 |
!!!cp ('t205'); |
!!!cp ('t205'); |
| 4908 |
!!!insert-element ('tr',, $token); |
!!!insert-element ('tr',, $token); |
| 4913 |
} |
} |
| 4914 |
|
|
| 4915 |
## Clear back to table row context |
## Clear back to table row context |
| 4916 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 4917 |
tr => 1, html => 1, |
& TABLE_ROW_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 4918 |
!!!cp ('t207'); |
!!!cp ('t207'); |
| 4919 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4920 |
} |
} |
| 4924 |
|
|
| 4925 |
push @$active_formatting_elements, ['#marker', '']; |
push @$active_formatting_elements, ['#marker', '']; |
| 4926 |
|
|
| 4927 |
|
!!!nack ('t207.1'); |
| 4928 |
!!!next-token; |
!!!next-token; |
| 4929 |
redo B; |
next B; |
| 4930 |
} elsif ({ |
} elsif ({ |
| 4931 |
caption => 1, col => 1, colgroup => 1, |
caption => 1, col => 1, colgroup => 1, |
| 4932 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
| 4938 |
my $i; |
my $i; |
| 4939 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 4940 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4941 |
if ($node->[1] eq 'tr') { |
if ($node->[1] & TABLE_ROW_EL) { |
| 4942 |
!!!cp ('t208'); |
!!!cp ('t208'); |
| 4943 |
$i = $_; |
$i = $_; |
| 4944 |
last INSCOPE; |
last INSCOPE; |
| 4945 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
html => 1, |
|
|
|
|
|
## NOTE: This element does not appear here, maybe. |
|
|
table => 1, |
|
|
}->{$node->[1]}) { |
|
| 4946 |
!!!cp ('t209'); |
!!!cp ('t209'); |
| 4947 |
last INSCOPE; |
last INSCOPE; |
| 4948 |
} |
} |
| 4949 |
} # INSCOPE |
} # INSCOPE |
| 4950 |
unless (defined $i) { |
unless (defined $i) { |
| 4951 |
!!!cp ('t210'); |
!!!cp ('t210'); |
| 4952 |
## TODO: This type is wrong. |
## TODO: This type is wrong. |
| 4953 |
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}, token => $token); |
| 4954 |
## Ignore the token |
## Ignore the token |
| 4955 |
|
!!!nack ('t210.1'); |
| 4956 |
!!!next-token; |
!!!next-token; |
| 4957 |
redo B; |
next B; |
| 4958 |
} |
} |
| 4959 |
|
|
| 4960 |
## Clear back to table row context |
## Clear back to table row context |
| 4961 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 4962 |
tr => 1, html => 1, |
& TABLE_ROW_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 4963 |
!!!cp ('t211'); |
!!!cp ('t211'); |
| 4964 |
## ISSUE: Can this case be reached? |
## ISSUE: Can this case be reached? |
| 4965 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 4970 |
if ($token->{tag_name} eq 'tr') { |
if ($token->{tag_name} eq 'tr') { |
| 4971 |
!!!cp ('t212'); |
!!!cp ('t212'); |
| 4972 |
## reprocess |
## reprocess |
| 4973 |
redo B; |
!!!ack-later; |
| 4974 |
|
next B; |
| 4975 |
} else { |
} else { |
| 4976 |
!!!cp ('t213'); |
!!!cp ('t213'); |
| 4977 |
## reprocess in the "in table body" insertion mode... |
## reprocess in the "in table body" insertion mode... |
| 4983 |
my $i; |
my $i; |
| 4984 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 4985 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4986 |
if ({ |
if ($node->[1] & TABLE_ROW_GROUP_EL) { |
|
tbody => 1, thead => 1, tfoot => 1, |
|
|
}->{$node->[1]}) { |
|
| 4987 |
!!!cp ('t214'); |
!!!cp ('t214'); |
| 4988 |
$i = $_; |
$i = $_; |
| 4989 |
last INSCOPE; |
last INSCOPE; |
| 4990 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 4991 |
!!!cp ('t215'); |
!!!cp ('t215'); |
| 4992 |
last INSCOPE; |
last INSCOPE; |
| 4993 |
} |
} |
| 4997 |
## TODO: This erorr type ios wrong. |
## TODO: This erorr type ios wrong. |
| 4998 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 4999 |
## Ignore the token |
## Ignore the token |
| 5000 |
|
!!!nack ('t216.1'); |
| 5001 |
!!!next-token; |
!!!next-token; |
| 5002 |
redo B; |
next B; |
| 5003 |
} |
} |
| 5004 |
|
|
| 5005 |
## Clear back to table body context |
## Clear back to table body context |
| 5006 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 5007 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
& TABLE_ROWS_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 5008 |
!!!cp ('t217'); |
!!!cp ('t217'); |
| 5009 |
## ISSUE: Can this state be reached? |
## ISSUE: Can this state be reached? |
| 5010 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5026 |
|
|
| 5027 |
if ($token->{tag_name} eq 'col') { |
if ($token->{tag_name} eq 'col') { |
| 5028 |
## Clear back to table context |
## Clear back to table context |
| 5029 |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
while (not ($self->{open_elements}->[-1]->[1] |
| 5030 |
$self->{open_elements}->[-1]->[1] ne 'html') { |
& TABLE_SCOPING_EL)) { |
| 5031 |
!!!cp ('t219'); |
!!!cp ('t219'); |
| 5032 |
## ISSUE: Can this state be reached? |
## ISSUE: Can this state be reached? |
| 5033 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5036 |
!!!insert-element ('colgroup',, $token); |
!!!insert-element ('colgroup',, $token); |
| 5037 |
$self->{insertion_mode} = IN_COLUMN_GROUP_IM; |
$self->{insertion_mode} = IN_COLUMN_GROUP_IM; |
| 5038 |
## reprocess |
## reprocess |
| 5039 |
redo B; |
!!!ack-later; |
| 5040 |
|
next B; |
| 5041 |
} elsif ({ |
} elsif ({ |
| 5042 |
caption => 1, |
caption => 1, |
| 5043 |
colgroup => 1, |
colgroup => 1, |
| 5044 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
| 5045 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5046 |
## Clear back to table context |
## Clear back to table context |
| 5047 |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
while (not ($self->{open_elements}->[-1]->[1] |
| 5048 |
$self->{open_elements}->[-1]->[1] ne 'html') { |
& TABLE_SCOPING_EL)) { |
| 5049 |
!!!cp ('t220'); |
!!!cp ('t220'); |
| 5050 |
## ISSUE: Can this state be reached? |
## ISSUE: Can this state be reached? |
| 5051 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5063 |
thead => IN_TABLE_BODY_IM, |
thead => IN_TABLE_BODY_IM, |
| 5064 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
| 5065 |
!!!next-token; |
!!!next-token; |
| 5066 |
redo B; |
!!!nack ('t220.1'); |
| 5067 |
|
next B; |
| 5068 |
} else { |
} else { |
| 5069 |
die "$0: in table: <>: $token->{tag_name}"; |
die "$0: in table: <>: $token->{tag_name}"; |
| 5070 |
} |
} |
| 5071 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
| 5072 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 5073 |
|
value => $self->{open_elements}->[-1]->[0] |
| 5074 |
|
->manakai_local_name, |
| 5075 |
|
token => $token); |
| 5076 |
|
|
| 5077 |
## As if </table> |
## As if </table> |
| 5078 |
## have a table element in table scope |
## have a table element in table scope |
| 5079 |
my $i; |
my $i; |
| 5080 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5081 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5082 |
if ($node->[1] eq 'table') { |
if ($node->[1] & TABLE_EL) { |
| 5083 |
!!!cp ('t221'); |
!!!cp ('t221'); |
| 5084 |
$i = $_; |
$i = $_; |
| 5085 |
last INSCOPE; |
last INSCOPE; |
| 5086 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
#table => 1, |
|
|
html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5087 |
!!!cp ('t222'); |
!!!cp ('t222'); |
| 5088 |
last INSCOPE; |
last INSCOPE; |
| 5089 |
} |
} |
| 5093 |
## TODO: The following is wrong, maybe. |
## TODO: The following is wrong, maybe. |
| 5094 |
!!!parse-error (type => 'unmatched end tag:table', token => $token); |
!!!parse-error (type => 'unmatched end tag:table', token => $token); |
| 5095 |
## Ignore tokens </table><table> |
## Ignore tokens </table><table> |
| 5096 |
|
!!!nack ('t223.1'); |
| 5097 |
!!!next-token; |
!!!next-token; |
| 5098 |
redo B; |
next B; |
| 5099 |
} |
} |
| 5100 |
|
|
| 5101 |
## TODO: Followings are removed from the latest spec. |
## TODO: Followings are removed from the latest spec. |
| 5102 |
## generate implied end tags |
## generate implied end tags |
| 5103 |
while ({ |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
|
dd => 1, dt => 1, li => 1, p => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 5104 |
!!!cp ('t224'); |
!!!cp ('t224'); |
| 5105 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5106 |
} |
} |
| 5107 |
|
|
| 5108 |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
unless ($self->{open_elements}->[-1]->[1] & TABLE_EL) { |
| 5109 |
!!!cp ('t225'); |
!!!cp ('t225'); |
| 5110 |
## ISSUE: Can this case be reached? |
## NOTE: |<table><tr><table>| |
| 5111 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 5112 |
|
value => $self->{open_elements}->[-1]->[0] |
| 5113 |
|
->manakai_local_name, |
| 5114 |
|
token => $token); |
| 5115 |
} else { |
} else { |
| 5116 |
!!!cp ('t226'); |
!!!cp ('t226'); |
| 5117 |
} |
} |
| 5121 |
|
|
| 5122 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
| 5123 |
|
|
| 5124 |
## reprocess |
## reprocess |
| 5125 |
redo B; |
!!!ack-later; |
| 5126 |
|
next B; |
| 5127 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
| 5128 |
if (not $open_tables->[-1]->[1]) { # tainted |
if (not $open_tables->[-1]->[1]) { # tainted |
| 5129 |
!!!cp ('t227.8'); |
!!!cp ('t227.8'); |
| 5130 |
## NOTE: This is a "as if in head" code clone. |
## NOTE: This is a "as if in head" code clone. |
| 5131 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 5132 |
redo B; |
next B; |
| 5133 |
} else { |
} else { |
| 5134 |
!!!cp ('t227.7'); |
!!!cp ('t227.7'); |
| 5135 |
# |
# |
| 5139 |
!!!cp ('t227.6'); |
!!!cp ('t227.6'); |
| 5140 |
## NOTE: This is a "as if in head" code clone. |
## NOTE: This is a "as if in head" code clone. |
| 5141 |
$script_start_tag->(); |
$script_start_tag->(); |
| 5142 |
redo B; |
next B; |
| 5143 |
} else { |
} else { |
| 5144 |
!!!cp ('t227.5'); |
!!!cp ('t227.5'); |
| 5145 |
# |
# |
| 5159 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5160 |
|
|
| 5161 |
!!!next-token; |
!!!next-token; |
| 5162 |
redo B; |
!!!ack ('t227.2.1'); |
| 5163 |
|
next B; |
| 5164 |
} else { |
} else { |
| 5165 |
!!!cp ('t227.2'); |
!!!cp ('t227.2'); |
| 5166 |
# |
# |
| 5189 |
my $i; |
my $i; |
| 5190 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5191 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5192 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] & TABLE_ROW_EL) { |
| 5193 |
!!!cp ('t228'); |
!!!cp ('t228'); |
| 5194 |
$i = $_; |
$i = $_; |
| 5195 |
last INSCOPE; |
last INSCOPE; |
| 5196 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5197 |
!!!cp ('t229'); |
!!!cp ('t229'); |
| 5198 |
last INSCOPE; |
last INSCOPE; |
| 5199 |
} |
} |
| 5202 |
!!!cp ('t230'); |
!!!cp ('t230'); |
| 5203 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5204 |
## Ignore the token |
## Ignore the token |
| 5205 |
|
!!!nack ('t230.1'); |
| 5206 |
!!!next-token; |
!!!next-token; |
| 5207 |
redo B; |
next B; |
| 5208 |
} else { |
} else { |
| 5209 |
!!!cp ('t232'); |
!!!cp ('t232'); |
| 5210 |
} |
} |
| 5211 |
|
|
| 5212 |
## Clear back to table row context |
## Clear back to table row context |
| 5213 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 5214 |
tr => 1, html => 1, |
& TABLE_ROW_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 5215 |
!!!cp ('t231'); |
!!!cp ('t231'); |
| 5216 |
## ISSUE: Can this state be reached? |
## ISSUE: Can this state be reached? |
| 5217 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5220 |
pop @{$self->{open_elements}}; # tr |
pop @{$self->{open_elements}}; # tr |
| 5221 |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
| 5222 |
!!!next-token; |
!!!next-token; |
| 5223 |
redo B; |
!!!nack ('t231.1'); |
| 5224 |
|
next B; |
| 5225 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
| 5226 |
if ($self->{insertion_mode} == IN_ROW_IM) { |
if ($self->{insertion_mode} == IN_ROW_IM) { |
| 5227 |
## As if </tr> |
## As if </tr> |
| 5229 |
my $i; |
my $i; |
| 5230 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5231 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5232 |
if ($node->[1] eq 'tr') { |
if ($node->[1] & TABLE_ROW_EL) { |
| 5233 |
!!!cp ('t233'); |
!!!cp ('t233'); |
| 5234 |
$i = $_; |
$i = $_; |
| 5235 |
last INSCOPE; |
last INSCOPE; |
| 5236 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5237 |
!!!cp ('t234'); |
!!!cp ('t234'); |
| 5238 |
last INSCOPE; |
last INSCOPE; |
| 5239 |
} |
} |
| 5243 |
## TODO: The following is wrong. |
## TODO: The following is wrong. |
| 5244 |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}, token => $token); |
| 5245 |
## Ignore the token |
## Ignore the token |
| 5246 |
|
!!!nack ('t236.1'); |
| 5247 |
!!!next-token; |
!!!next-token; |
| 5248 |
redo B; |
next B; |
| 5249 |
} |
} |
| 5250 |
|
|
| 5251 |
## Clear back to table row context |
## Clear back to table row context |
| 5252 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 5253 |
tr => 1, html => 1, |
& TABLE_ROW_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 5254 |
!!!cp ('t236'); |
!!!cp ('t236'); |
| 5255 |
## ISSUE: Can this state be reached? |
## ISSUE: Can this state be reached? |
| 5256 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5266 |
my $i; |
my $i; |
| 5267 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5268 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5269 |
if ({ |
if ($node->[1] & TABLE_ROW_GROUP_EL) { |
|
tbody => 1, thead => 1, tfoot => 1, |
|
|
}->{$node->[1]}) { |
|
| 5270 |
!!!cp ('t237'); |
!!!cp ('t237'); |
| 5271 |
$i = $_; |
$i = $_; |
| 5272 |
last INSCOPE; |
last INSCOPE; |
| 5273 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5274 |
!!!cp ('t238'); |
!!!cp ('t238'); |
| 5275 |
last INSCOPE; |
last INSCOPE; |
| 5276 |
} |
} |
| 5279 |
!!!cp ('t239'); |
!!!cp ('t239'); |
| 5280 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5281 |
## Ignore the token |
## Ignore the token |
| 5282 |
|
!!!nack ('t239.1'); |
| 5283 |
!!!next-token; |
!!!next-token; |
| 5284 |
redo B; |
next B; |
| 5285 |
} |
} |
| 5286 |
|
|
| 5287 |
## Clear back to table body context |
## Clear back to table body context |
| 5288 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 5289 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
& TABLE_ROWS_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 5290 |
!!!cp ('t240'); |
!!!cp ('t240'); |
| 5291 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5292 |
} |
} |
| 5312 |
my $i; |
my $i; |
| 5313 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5314 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5315 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] & TABLE_EL) { |
| 5316 |
!!!cp ('t241'); |
!!!cp ('t241'); |
| 5317 |
$i = $_; |
$i = $_; |
| 5318 |
last INSCOPE; |
last INSCOPE; |
| 5319 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5320 |
!!!cp ('t242'); |
!!!cp ('t242'); |
| 5321 |
last INSCOPE; |
last INSCOPE; |
| 5322 |
} |
} |
| 5325 |
!!!cp ('t243'); |
!!!cp ('t243'); |
| 5326 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5327 |
## Ignore the token |
## Ignore the token |
| 5328 |
|
!!!nack ('t243.1'); |
| 5329 |
!!!next-token; |
!!!next-token; |
| 5330 |
redo B; |
next B; |
| 5331 |
} |
} |
| 5332 |
|
|
| 5333 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
| 5336 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
| 5337 |
|
|
| 5338 |
!!!next-token; |
!!!next-token; |
| 5339 |
redo B; |
next B; |
| 5340 |
} elsif ({ |
} elsif ({ |
| 5341 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
| 5342 |
}->{$token->{tag_name}} and |
}->{$token->{tag_name}} and |
| 5346 |
my $i; |
my $i; |
| 5347 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5348 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5349 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[0]->manakai_local_name eq $token->{tag_name}) { |
| 5350 |
!!!cp ('t247'); |
!!!cp ('t247'); |
| 5351 |
$i = $_; |
$i = $_; |
| 5352 |
last INSCOPE; |
last INSCOPE; |
| 5353 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5354 |
!!!cp ('t248'); |
!!!cp ('t248'); |
| 5355 |
last INSCOPE; |
last INSCOPE; |
| 5356 |
} |
} |
| 5359 |
!!!cp ('t249'); |
!!!cp ('t249'); |
| 5360 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5361 |
## Ignore the token |
## Ignore the token |
| 5362 |
|
!!!nack ('t249.1'); |
| 5363 |
!!!next-token; |
!!!next-token; |
| 5364 |
redo B; |
next B; |
| 5365 |
} |
} |
| 5366 |
|
|
| 5367 |
## As if </tr> |
## As if </tr> |
| 5369 |
my $i; |
my $i; |
| 5370 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5371 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5372 |
if ($node->[1] eq 'tr') { |
if ($node->[1] & TABLE_ROW_EL) { |
| 5373 |
!!!cp ('t250'); |
!!!cp ('t250'); |
| 5374 |
$i = $_; |
$i = $_; |
| 5375 |
last INSCOPE; |
last INSCOPE; |
| 5376 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5377 |
!!!cp ('t251'); |
!!!cp ('t251'); |
| 5378 |
last INSCOPE; |
last INSCOPE; |
| 5379 |
} |
} |
| 5382 |
!!!cp ('t252'); |
!!!cp ('t252'); |
| 5383 |
!!!parse-error (type => 'unmatched end tag:tr', token => $token); |
!!!parse-error (type => 'unmatched end tag:tr', token => $token); |
| 5384 |
## Ignore the token |
## Ignore the token |
| 5385 |
|
!!!nack ('t252.1'); |
| 5386 |
!!!next-token; |
!!!next-token; |
| 5387 |
redo B; |
next B; |
| 5388 |
} |
} |
| 5389 |
|
|
| 5390 |
## Clear back to table row context |
## Clear back to table row context |
| 5391 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 5392 |
tr => 1, html => 1, |
& TABLE_ROW_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 5393 |
!!!cp ('t253'); |
!!!cp ('t253'); |
| 5394 |
## ISSUE: Can this case be reached? |
## ISSUE: Can this case be reached? |
| 5395 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5404 |
my $i; |
my $i; |
| 5405 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5406 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5407 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[0]->manakai_local_name eq $token->{tag_name}) { |
| 5408 |
!!!cp ('t254'); |
!!!cp ('t254'); |
| 5409 |
$i = $_; |
$i = $_; |
| 5410 |
last INSCOPE; |
last INSCOPE; |
| 5411 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5412 |
!!!cp ('t255'); |
!!!cp ('t255'); |
| 5413 |
last INSCOPE; |
last INSCOPE; |
| 5414 |
} |
} |
| 5417 |
!!!cp ('t256'); |
!!!cp ('t256'); |
| 5418 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5419 |
## Ignore the token |
## Ignore the token |
| 5420 |
|
!!!nack ('t256.1'); |
| 5421 |
!!!next-token; |
!!!next-token; |
| 5422 |
redo B; |
next B; |
| 5423 |
} |
} |
| 5424 |
|
|
| 5425 |
## Clear back to table body context |
## Clear back to table body context |
| 5426 |
while (not { |
while (not ($self->{open_elements}->[-1]->[1] |
| 5427 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
& TABLE_ROWS_SCOPING_EL)) { |
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 5428 |
!!!cp ('t257'); |
!!!cp ('t257'); |
| 5429 |
## ISSUE: Can this case be reached? |
## ISSUE: Can this case be reached? |
| 5430 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5432 |
|
|
| 5433 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5434 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5435 |
|
!!!nack ('t257.1'); |
| 5436 |
!!!next-token; |
!!!next-token; |
| 5437 |
redo B; |
next B; |
| 5438 |
} elsif ({ |
} elsif ({ |
| 5439 |
body => 1, caption => 1, col => 1, colgroup => 1, |
body => 1, caption => 1, col => 1, colgroup => 1, |
| 5440 |
html => 1, td => 1, th => 1, |
html => 1, td => 1, th => 1, |
| 5441 |
tr => 1, # $self->{insertion_mode} == IN_ROW_IM |
tr => 1, # $self->{insertion_mode} == IN_ROW_IM |
| 5442 |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM |
| 5443 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5444 |
!!!cp ('t258'); |
!!!cp ('t258'); |
| 5445 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5446 |
## Ignore the token |
## Ignore the token |
| 5447 |
!!!next-token; |
!!!nack ('t258.1'); |
| 5448 |
redo B; |
!!!next-token; |
| 5449 |
|
next B; |
| 5450 |
} else { |
} else { |
| 5451 |
!!!cp ('t259'); |
!!!cp ('t259'); |
| 5452 |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
| 5455 |
# |
# |
| 5456 |
} |
} |
| 5457 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5458 |
unless ($self->{open_elements}->[-1]->[1] eq 'html' and |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
| 5459 |
@{$self->{open_elements}} == 1) { # redundant, maybe |
@{$self->{open_elements}} == 1) { # redundant, maybe |
| 5460 |
!!!parse-error (type => 'in body:#eof', token => $token); |
!!!parse-error (type => 'in body:#eof', token => $token); |
| 5461 |
!!!cp ('t259.1'); |
!!!cp ('t259.1'); |
| 5477 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 5478 |
!!!cp ('t260'); |
!!!cp ('t260'); |
| 5479 |
!!!next-token; |
!!!next-token; |
| 5480 |
redo B; |
next B; |
| 5481 |
} |
} |
| 5482 |
} |
} |
| 5483 |
|
|
| 5488 |
!!!cp ('t262'); |
!!!cp ('t262'); |
| 5489 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 5490 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5491 |
|
!!!ack ('t262.1'); |
| 5492 |
!!!next-token; |
!!!next-token; |
| 5493 |
redo B; |
next B; |
| 5494 |
} else { |
} else { |
| 5495 |
!!!cp ('t263'); |
!!!cp ('t263'); |
| 5496 |
# |
# |
| 5497 |
} |
} |
| 5498 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 5499 |
if ($token->{tag_name} eq 'colgroup') { |
if ($token->{tag_name} eq 'colgroup') { |
| 5500 |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
if ($self->{open_elements}->[-1]->[1] & HTML_EL) { |
| 5501 |
!!!cp ('t264'); |
!!!cp ('t264'); |
| 5502 |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
| 5503 |
## Ignore the token |
## Ignore the token |
| 5504 |
!!!next-token; |
!!!next-token; |
| 5505 |
redo B; |
next B; |
| 5506 |
} else { |
} else { |
| 5507 |
!!!cp ('t265'); |
!!!cp ('t265'); |
| 5508 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
| 5509 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5510 |
!!!next-token; |
!!!next-token; |
| 5511 |
redo B; |
next B; |
| 5512 |
} |
} |
| 5513 |
} elsif ($token->{tag_name} eq 'col') { |
} elsif ($token->{tag_name} eq 'col') { |
| 5514 |
!!!cp ('t266'); |
!!!cp ('t266'); |
| 5515 |
!!!parse-error (type => 'unmatched end tag:col', token => $token); |
!!!parse-error (type => 'unmatched end tag:col', token => $token); |
| 5516 |
## Ignore the token |
## Ignore the token |
| 5517 |
!!!next-token; |
!!!next-token; |
| 5518 |
redo B; |
next B; |
| 5519 |
} else { |
} else { |
| 5520 |
!!!cp ('t267'); |
!!!cp ('t267'); |
| 5521 |
# |
# |
| 5522 |
} |
} |
| 5523 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5524 |
if ($self->{open_elements}->[-1]->[1] eq 'html' or |
if ($self->{open_elements}->[-1]->[1] & HTML_EL and |
| 5525 |
@{$self->{open_elements}} == 1) { # redundant, maybe |
@{$self->{open_elements}} == 1) { # redundant, maybe |
| 5526 |
!!!cp ('t270.2'); |
!!!cp ('t270.2'); |
| 5527 |
## Stop parsing. |
## Stop parsing. |
| 5532 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
| 5533 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5534 |
## Reprocess. |
## Reprocess. |
| 5535 |
redo B; |
next B; |
| 5536 |
} |
} |
| 5537 |
} else { |
} else { |
| 5538 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
| 5539 |
} |
} |
| 5540 |
|
|
| 5541 |
## As if </colgroup> |
## As if </colgroup> |
| 5542 |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
if ($self->{open_elements}->[-1]->[1] & HTML_EL) { |
| 5543 |
!!!cp ('t269'); |
!!!cp ('t269'); |
| 5544 |
## TODO: Wrong error type? |
## TODO: Wrong error type? |
| 5545 |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
| 5546 |
## Ignore the token |
## Ignore the token |
| 5547 |
|
!!!nack ('t269.1'); |
| 5548 |
!!!next-token; |
!!!next-token; |
| 5549 |
redo B; |
next B; |
| 5550 |
} else { |
} else { |
| 5551 |
!!!cp ('t270'); |
!!!cp ('t270'); |
| 5552 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
| 5553 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 5554 |
|
!!!ack-later; |
| 5555 |
## reprocess |
## reprocess |
| 5556 |
redo B; |
next B; |
| 5557 |
} |
} |
| 5558 |
} elsif ($self->{insertion_mode} & SELECT_IMS) { |
} elsif ($self->{insertion_mode} & SELECT_IMS) { |
| 5559 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 5560 |
!!!cp ('t271'); |
!!!cp ('t271'); |
| 5561 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 5562 |
!!!next-token; |
!!!next-token; |
| 5563 |
redo B; |
next B; |
| 5564 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 5565 |
if ($token->{tag_name} eq 'option') { |
if ($token->{tag_name} eq 'option') { |
| 5566 |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
| 5567 |
!!!cp ('t272'); |
!!!cp ('t272'); |
| 5568 |
## As if </option> |
## As if </option> |
| 5569 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5570 |
} else { |
} else { |
| 5571 |
!!!cp ('t273'); |
!!!cp ('t273'); |
| 5572 |
} |
} |
| 5573 |
|
|
| 5574 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 5575 |
!!!next-token; |
!!!nack ('t273.1'); |
| 5576 |
redo B; |
!!!next-token; |
| 5577 |
} elsif ($token->{tag_name} eq 'optgroup') { |
next B; |
| 5578 |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
} elsif ($token->{tag_name} eq 'optgroup') { |
| 5579 |
!!!cp ('t274'); |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
| 5580 |
## As if </option> |
!!!cp ('t274'); |
| 5581 |
pop @{$self->{open_elements}}; |
## As if </option> |
| 5582 |
} else { |
pop @{$self->{open_elements}}; |
| 5583 |
!!!cp ('t275'); |
} else { |
| 5584 |
} |
!!!cp ('t275'); |
| 5585 |
|
} |
| 5586 |
|
|
| 5587 |
if ($self->{open_elements}->[-1]->[1] eq 'optgroup') { |
if ($self->{open_elements}->[-1]->[1] & OPTGROUP_EL) { |
| 5588 |
!!!cp ('t276'); |
!!!cp ('t276'); |
| 5589 |
## As if </optgroup> |
## As if </optgroup> |
| 5590 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5591 |
} else { |
} else { |
| 5592 |
!!!cp ('t277'); |
!!!cp ('t277'); |
| 5593 |
} |
} |
| 5594 |
|
|
| 5595 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 5596 |
!!!next-token; |
!!!nack ('t277.1'); |
| 5597 |
redo B; |
!!!next-token; |
| 5598 |
|
next B; |
| 5599 |
} elsif ($token->{tag_name} eq 'select' or |
} elsif ($token->{tag_name} eq 'select' or |
| 5600 |
$token->{tag_name} eq 'input' or |
$token->{tag_name} eq 'input' or |
| 5601 |
($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
| 5608 |
!!!parse-error (type => 'not closed:select', token => $token); |
!!!parse-error (type => 'not closed:select', token => $token); |
| 5609 |
## NOTE: As if the token were </select> (<select> case) or |
## NOTE: As if the token were </select> (<select> case) or |
| 5610 |
## as if there were </select> (otherwise). |
## as if there were </select> (otherwise). |
| 5611 |
## have an element in table scope |
## have an element in table scope |
| 5612 |
my $i; |
my $i; |
| 5613 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5614 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5615 |
if ($node->[1] eq 'select') { |
if ($node->[1] & SELECT_EL) { |
| 5616 |
!!!cp ('t278'); |
!!!cp ('t278'); |
| 5617 |
$i = $_; |
$i = $_; |
| 5618 |
last INSCOPE; |
last INSCOPE; |
| 5619 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
| 5620 |
table => 1, html => 1, |
!!!cp ('t279'); |
| 5621 |
}->{$node->[1]}) { |
last INSCOPE; |
| 5622 |
!!!cp ('t279'); |
} |
| 5623 |
last INSCOPE; |
} # INSCOPE |
| 5624 |
} |
unless (defined $i) { |
| 5625 |
} # INSCOPE |
!!!cp ('t280'); |
| 5626 |
unless (defined $i) { |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
| 5627 |
!!!cp ('t280'); |
## Ignore the token |
| 5628 |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
!!!nack ('t280.1'); |
| 5629 |
## Ignore the token |
!!!next-token; |
| 5630 |
!!!next-token; |
next B; |
| 5631 |
redo B; |
} |
|
} |
|
| 5632 |
|
|
| 5633 |
!!!cp ('t281'); |
!!!cp ('t281'); |
| 5634 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
| 5635 |
|
|
| 5636 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
| 5637 |
|
|
| 5638 |
if ($token->{tag_name} eq 'select') { |
if ($token->{tag_name} eq 'select') { |
| 5639 |
!!!cp ('t281.2'); |
!!!nack ('t281.2'); |
| 5640 |
!!!next-token; |
!!!next-token; |
| 5641 |
redo B; |
next B; |
| 5642 |
} else { |
} else { |
| 5643 |
!!!cp ('t281.1'); |
!!!cp ('t281.1'); |
| 5644 |
|
!!!ack-later; |
| 5645 |
## Reprocess the token. |
## Reprocess the token. |
| 5646 |
redo B; |
next B; |
| 5647 |
} |
} |
| 5648 |
} else { |
} else { |
| 5649 |
!!!cp ('t282'); |
!!!cp ('t282'); |
| 5650 |
!!!parse-error (type => 'in select:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in select:'.$token->{tag_name}, token => $token); |
| 5651 |
## Ignore the token |
## Ignore the token |
| 5652 |
|
!!!nack ('t282.1'); |
| 5653 |
!!!next-token; |
!!!next-token; |
| 5654 |
redo B; |
next B; |
| 5655 |
} |
} |
| 5656 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 5657 |
if ($token->{tag_name} eq 'optgroup') { |
if ($token->{tag_name} eq 'optgroup') { |
| 5658 |
if ($self->{open_elements}->[-1]->[1] eq 'option' and |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL and |
| 5659 |
$self->{open_elements}->[-2]->[1] eq 'optgroup') { |
$self->{open_elements}->[-2]->[1] & OPTGROUP_EL) { |
| 5660 |
!!!cp ('t283'); |
!!!cp ('t283'); |
| 5661 |
## As if </option> |
## As if </option> |
| 5662 |
splice @{$self->{open_elements}}, -2; |
splice @{$self->{open_elements}}, -2; |
| 5663 |
} elsif ($self->{open_elements}->[-1]->[1] eq 'optgroup') { |
} elsif ($self->{open_elements}->[-1]->[1] & OPTGROUP_EL) { |
| 5664 |
!!!cp ('t284'); |
!!!cp ('t284'); |
| 5665 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5666 |
} else { |
} else { |
| 5667 |
!!!cp ('t285'); |
!!!cp ('t285'); |
| 5668 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5669 |
## Ignore the token |
## Ignore the token |
| 5670 |
} |
} |
| 5671 |
!!!next-token; |
!!!nack ('t285.1'); |
| 5672 |
redo B; |
!!!next-token; |
| 5673 |
} elsif ($token->{tag_name} eq 'option') { |
next B; |
| 5674 |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
} elsif ($token->{tag_name} eq 'option') { |
| 5675 |
!!!cp ('t286'); |
if ($self->{open_elements}->[-1]->[1] & OPTION_EL) { |
| 5676 |
pop @{$self->{open_elements}}; |
!!!cp ('t286'); |
| 5677 |
} else { |
pop @{$self->{open_elements}}; |
| 5678 |
!!!cp ('t287'); |
} else { |
| 5679 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!cp ('t287'); |
| 5680 |
## Ignore the token |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5681 |
} |
## Ignore the token |
| 5682 |
!!!next-token; |
} |
| 5683 |
redo B; |
!!!nack ('t287.1'); |
| 5684 |
} elsif ($token->{tag_name} eq 'select') { |
!!!next-token; |
| 5685 |
## have an element in table scope |
next B; |
| 5686 |
my $i; |
} elsif ($token->{tag_name} eq 'select') { |
| 5687 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
## have an element in table scope |
| 5688 |
my $node = $self->{open_elements}->[$_]; |
my $i; |
| 5689 |
if ($node->[1] eq $token->{tag_name}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5690 |
!!!cp ('t288'); |
my $node = $self->{open_elements}->[$_]; |
| 5691 |
$i = $_; |
if ($node->[1] & SELECT_EL) { |
| 5692 |
last INSCOPE; |
!!!cp ('t288'); |
| 5693 |
} elsif ({ |
$i = $_; |
| 5694 |
table => 1, html => 1, |
last INSCOPE; |
| 5695 |
}->{$node->[1]}) { |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
| 5696 |
!!!cp ('t289'); |
!!!cp ('t289'); |
| 5697 |
last INSCOPE; |
last INSCOPE; |
| 5698 |
} |
} |
| 5699 |
} # INSCOPE |
} # INSCOPE |
| 5700 |
unless (defined $i) { |
unless (defined $i) { |
| 5701 |
!!!cp ('t290'); |
!!!cp ('t290'); |
| 5702 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5703 |
## Ignore the token |
## Ignore the token |
| 5704 |
!!!next-token; |
!!!nack ('t290.1'); |
| 5705 |
redo B; |
!!!next-token; |
| 5706 |
} |
next B; |
| 5707 |
|
} |
| 5708 |
|
|
| 5709 |
!!!cp ('t291'); |
!!!cp ('t291'); |
| 5710 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
| 5711 |
|
|
| 5712 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
| 5713 |
|
|
| 5714 |
!!!next-token; |
!!!nack ('t291.1'); |
| 5715 |
redo B; |
!!!next-token; |
| 5716 |
|
next B; |
| 5717 |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
| 5718 |
{ |
{ |
| 5719 |
caption => 1, table => 1, tbody => 1, |
caption => 1, table => 1, tbody => 1, |
| 5720 |
tfoot => 1, thead => 1, tr => 1, td => 1, th => 1, |
tfoot => 1, thead => 1, tr => 1, td => 1, th => 1, |
| 5721 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 5722 |
## TODO: The following is wrong? |
## TODO: The following is wrong? |
| 5723 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5724 |
|
|
| 5725 |
## have an element in table scope |
## have an element in table scope |
| 5726 |
my $i; |
my $i; |
| 5727 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5728 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5729 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[0]->manakai_local_name eq $token->{tag_name}) { |
| 5730 |
!!!cp ('t292'); |
!!!cp ('t292'); |
| 5731 |
$i = $_; |
$i = $_; |
| 5732 |
last INSCOPE; |
last INSCOPE; |
| 5733 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
| 5734 |
table => 1, html => 1, |
!!!cp ('t293'); |
| 5735 |
}->{$node->[1]}) { |
last INSCOPE; |
| 5736 |
!!!cp ('t293'); |
} |
| 5737 |
last INSCOPE; |
} # INSCOPE |
| 5738 |
} |
unless (defined $i) { |
| 5739 |
} # INSCOPE |
!!!cp ('t294'); |
| 5740 |
unless (defined $i) { |
## Ignore the token |
| 5741 |
!!!cp ('t294'); |
!!!nack ('t294.1'); |
| 5742 |
## Ignore the token |
!!!next-token; |
| 5743 |
!!!next-token; |
next B; |
| 5744 |
redo B; |
} |
|
} |
|
| 5745 |
|
|
| 5746 |
## As if </select> |
## As if </select> |
| 5747 |
## have an element in table scope |
## have an element in table scope |
| 5748 |
undef $i; |
undef $i; |
| 5749 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 5750 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 5751 |
if ($node->[1] eq 'select') { |
if ($node->[1] & SELECT_EL) { |
| 5752 |
!!!cp ('t295'); |
!!!cp ('t295'); |
| 5753 |
$i = $_; |
$i = $_; |
| 5754 |
last INSCOPE; |
last INSCOPE; |
| 5755 |
} elsif ({ |
} elsif ($node->[1] & TABLE_SCOPING_EL) { |
|
table => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 5756 |
## ISSUE: Can this state be reached? |
## ISSUE: Can this state be reached? |
| 5757 |
!!!cp ('t296'); |
!!!cp ('t296'); |
| 5758 |
last INSCOPE; |
last INSCOPE; |
| 5759 |
} |
} |
| 5760 |
} # INSCOPE |
} # INSCOPE |
| 5761 |
unless (defined $i) { |
unless (defined $i) { |
| 5762 |
!!!cp ('t297'); |
!!!cp ('t297'); |
| 5763 |
## TODO: The following error type is correct? |
## TODO: The following error type is correct? |
| 5764 |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
| 5765 |
## Ignore the </select> token |
## Ignore the </select> token |
| 5766 |
!!!next-token; ## TODO: ok? |
!!!nack ('t297.1'); |
| 5767 |
redo B; |
!!!next-token; ## TODO: ok? |
| 5768 |
} |
next B; |
| 5769 |
|
} |
| 5770 |
|
|
| 5771 |
!!!cp ('t298'); |
!!!cp ('t298'); |
| 5772 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
| 5773 |
|
|
| 5774 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
| 5775 |
|
|
| 5776 |
## reprocess |
!!!ack-later; |
| 5777 |
redo B; |
## reprocess |
| 5778 |
|
next B; |
| 5779 |
} else { |
} else { |
| 5780 |
!!!cp ('t299'); |
!!!cp ('t299'); |
| 5781 |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
| 5782 |
## Ignore the token |
## Ignore the token |
| 5783 |
|
!!!nack ('t299.3'); |
| 5784 |
!!!next-token; |
!!!next-token; |
| 5785 |
redo B; |
next B; |
| 5786 |
} |
} |
| 5787 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5788 |
unless ($self->{open_elements}->[-1]->[1] eq 'html' and |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
| 5789 |
@{$self->{open_elements}} == 1) { # redundant, maybe |
@{$self->{open_elements}} == 1) { # redundant, maybe |
| 5790 |
!!!cp ('t299.1'); |
!!!cp ('t299.1'); |
| 5791 |
!!!parse-error (type => 'in body:#eof', token => $token); |
!!!parse-error (type => 'in body:#eof', token => $token); |
| 5810 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 5811 |
!!!cp ('t300'); |
!!!cp ('t300'); |
| 5812 |
!!!next-token; |
!!!next-token; |
| 5813 |
redo B; |
next B; |
| 5814 |
} |
} |
| 5815 |
} |
} |
| 5816 |
|
|
| 5828 |
|
|
| 5829 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 5830 |
## reprocess |
## reprocess |
| 5831 |
redo B; |
next B; |
| 5832 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
| 5833 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
| 5834 |
!!!cp ('t303'); |
!!!cp ('t303'); |
| 5843 |
!!!parse-error (type => 'after body:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after body:'.$token->{tag_name}, token => $token); |
| 5844 |
|
|
| 5845 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 5846 |
|
!!!ack-later; |
| 5847 |
## reprocess |
## reprocess |
| 5848 |
redo B; |
next B; |
| 5849 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 5850 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
| 5851 |
!!!cp ('t305'); |
!!!cp ('t305'); |
| 5864 |
!!!parse-error (type => 'unmatched end tag:html', token => $token); |
!!!parse-error (type => 'unmatched end tag:html', token => $token); |
| 5865 |
## Ignore the token |
## Ignore the token |
| 5866 |
!!!next-token; |
!!!next-token; |
| 5867 |
redo B; |
next B; |
| 5868 |
} else { |
} else { |
| 5869 |
!!!cp ('t308'); |
!!!cp ('t308'); |
| 5870 |
$self->{insertion_mode} = AFTER_HTML_BODY_IM; |
$self->{insertion_mode} = AFTER_HTML_BODY_IM; |
| 5871 |
!!!next-token; |
!!!next-token; |
| 5872 |
redo B; |
next B; |
| 5873 |
} |
} |
| 5874 |
} else { |
} else { |
| 5875 |
!!!cp ('t309'); |
!!!cp ('t309'); |
| 5877 |
|
|
| 5878 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
| 5879 |
## reprocess |
## reprocess |
| 5880 |
redo B; |
next B; |
| 5881 |
} |
} |
| 5882 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 5883 |
!!!cp ('t309.2'); |
!!!cp ('t309.2'); |
| 5894 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
| 5895 |
!!!cp ('t310'); |
!!!cp ('t310'); |
| 5896 |
!!!next-token; |
!!!next-token; |
| 5897 |
redo B; |
next B; |
| 5898 |
} |
} |
| 5899 |
} |
} |
| 5900 |
|
|
| 5922 |
!!!cp ('t315'); |
!!!cp ('t315'); |
| 5923 |
!!!next-token; |
!!!next-token; |
| 5924 |
} |
} |
| 5925 |
redo B; |
next B; |
| 5926 |
} |
} |
| 5927 |
|
|
| 5928 |
die qq[$0: Character "$token->{data}"]; |
die qq[$0: Character "$token->{data}"]; |
| 5941 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
| 5942 |
!!!cp ('t318'); |
!!!cp ('t318'); |
| 5943 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 5944 |
|
!!!nack ('t318.1'); |
| 5945 |
!!!next-token; |
!!!next-token; |
| 5946 |
redo B; |
next B; |
| 5947 |
} elsif ($token->{tag_name} eq 'frame' and |
} elsif ($token->{tag_name} eq 'frame' and |
| 5948 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
| 5949 |
!!!cp ('t319'); |
!!!cp ('t319'); |
| 5950 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
| 5951 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 5952 |
|
!!!ack ('t319.1'); |
| 5953 |
!!!next-token; |
!!!next-token; |
| 5954 |
redo B; |
next B; |
| 5955 |
} elsif ($token->{tag_name} eq 'noframes') { |
} elsif ($token->{tag_name} eq 'noframes') { |
| 5956 |
!!!cp ('t320'); |
!!!cp ('t320'); |
| 5957 |
## NOTE: As if in body. |
## NOTE: As if in body. |
| 5958 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 5959 |
redo B; |
next B; |
| 5960 |
} else { |
} else { |
| 5961 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
| 5962 |
!!!cp ('t321'); |
!!!cp ('t321'); |
| 5966 |
!!!parse-error (type => 'after frameset:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after frameset:'.$token->{tag_name}, token => $token); |
| 5967 |
} |
} |
| 5968 |
## Ignore the token |
## Ignore the token |
| 5969 |
|
!!!nack ('t322.1'); |
| 5970 |
!!!next-token; |
!!!next-token; |
| 5971 |
redo B; |
next B; |
| 5972 |
} |
} |
| 5973 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 5974 |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
| 5983 |
|
|
| 5984 |
if ($token->{tag_name} eq 'frameset' and |
if ($token->{tag_name} eq 'frameset' and |
| 5985 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
| 5986 |
if ($self->{open_elements}->[-1]->[1] eq 'html' and |
if ($self->{open_elements}->[-1]->[1] & HTML_EL and |
| 5987 |
@{$self->{open_elements}} == 1) { |
@{$self->{open_elements}} == 1) { |
| 5988 |
!!!cp ('t325'); |
!!!cp ('t325'); |
| 5989 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 5996 |
} |
} |
| 5997 |
|
|
| 5998 |
if (not defined $self->{inner_html_node} and |
if (not defined $self->{inner_html_node} and |
| 5999 |
$self->{open_elements}->[-1]->[1] ne 'frameset') { |
not ($self->{open_elements}->[-1]->[1] & FRAMESET_EL)) { |
| 6000 |
!!!cp ('t327'); |
!!!cp ('t327'); |
| 6001 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
| 6002 |
} else { |
} else { |
| 6003 |
!!!cp ('t328'); |
!!!cp ('t328'); |
| 6004 |
} |
} |
| 6005 |
redo B; |
next B; |
| 6006 |
} elsif ($token->{tag_name} eq 'html' and |
} elsif ($token->{tag_name} eq 'html' and |
| 6007 |
$self->{insertion_mode} == AFTER_FRAMESET_IM) { |
$self->{insertion_mode} == AFTER_FRAMESET_IM) { |
| 6008 |
!!!cp ('t329'); |
!!!cp ('t329'); |
| 6009 |
$self->{insertion_mode} = AFTER_HTML_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_HTML_FRAMESET_IM; |
| 6010 |
!!!next-token; |
!!!next-token; |
| 6011 |
redo B; |
next B; |
| 6012 |
} else { |
} else { |
| 6013 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
| 6014 |
!!!cp ('t330'); |
!!!cp ('t330'); |
| 6019 |
} |
} |
| 6020 |
## Ignore the token |
## Ignore the token |
| 6021 |
!!!next-token; |
!!!next-token; |
| 6022 |
redo B; |
next B; |
| 6023 |
} |
} |
| 6024 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
| 6025 |
unless ($self->{open_elements}->[-1]->[1] eq 'html' and |
unless ($self->{open_elements}->[-1]->[1] & HTML_EL and |
| 6026 |
@{$self->{open_elements}} == 1) { # redundant, maybe |
@{$self->{open_elements}} == 1) { # redundant, maybe |
| 6027 |
!!!cp ('t331.1'); |
!!!cp ('t331.1'); |
| 6028 |
!!!parse-error (type => 'in body:#eof', token => $token); |
!!!parse-error (type => 'in body:#eof', token => $token); |
| 6047 |
!!!cp ('t332'); |
!!!cp ('t332'); |
| 6048 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
| 6049 |
$script_start_tag->(); |
$script_start_tag->(); |
| 6050 |
redo B; |
next B; |
| 6051 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
| 6052 |
!!!cp ('t333'); |
!!!cp ('t333'); |
| 6053 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
| 6054 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 6055 |
redo B; |
next B; |
| 6056 |
} elsif ({ |
} elsif ({ |
| 6057 |
base => 1, link => 1, |
base => 1, link => 1, |
| 6058 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6060 |
## 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 |
| 6061 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 6062 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
| 6063 |
|
!!!ack ('t334.1'); |
| 6064 |
!!!next-token; |
!!!next-token; |
| 6065 |
redo B; |
next B; |
| 6066 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
| 6067 |
## 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 |
| 6068 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 6111 |
} |
} |
| 6112 |
} |
} |
| 6113 |
|
|
| 6114 |
|
!!!ack ('t338.1'); |
| 6115 |
!!!next-token; |
!!!next-token; |
| 6116 |
redo B; |
next B; |
| 6117 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
| 6118 |
!!!cp ('t341'); |
!!!cp ('t341'); |
| 6119 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
| 6120 |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
| 6121 |
redo B; |
next B; |
| 6122 |
} elsif ($token->{tag_name} eq 'body') { |
} elsif ($token->{tag_name} eq 'body') { |
| 6123 |
!!!parse-error (type => 'in body:body', token => $token); |
!!!parse-error (type => 'in body:body', token => $token); |
| 6124 |
|
|
| 6125 |
if (@{$self->{open_elements}} == 1 or |
if (@{$self->{open_elements}} == 1 or |
| 6126 |
$self->{open_elements}->[1]->[1] ne 'body') { |
not ($self->{open_elements}->[1]->[1] & BODY_EL)) { |
| 6127 |
!!!cp ('t342'); |
!!!cp ('t342'); |
| 6128 |
## Ignore the token |
## Ignore the token |
| 6129 |
} else { |
} else { |
| 6137 |
} |
} |
| 6138 |
} |
} |
| 6139 |
} |
} |
| 6140 |
|
!!!nack ('t343.1'); |
| 6141 |
!!!next-token; |
!!!next-token; |
| 6142 |
redo B; |
next B; |
| 6143 |
} elsif ({ |
} elsif ({ |
| 6144 |
address => 1, blockquote => 1, center => 1, dir => 1, |
address => 1, blockquote => 1, center => 1, dir => 1, |
| 6145 |
div => 1, dl => 1, fieldset => 1, |
div => 1, dl => 1, fieldset => 1, |
| 6154 |
!!!cp ('t350'); |
!!!cp ('t350'); |
| 6155 |
!!!parse-error (type => 'in form:form', token => $token); |
!!!parse-error (type => 'in form:form', token => $token); |
| 6156 |
## Ignore the token |
## Ignore the token |
| 6157 |
|
!!!nack ('t350.1'); |
| 6158 |
!!!next-token; |
!!!next-token; |
| 6159 |
redo B; |
next B; |
| 6160 |
} |
} |
| 6161 |
|
|
| 6162 |
## has a p element in scope |
## has a p element in scope |
| 6163 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 6164 |
if ($_->[1] eq 'p') { |
if ($_->[1] & P_EL) { |
| 6165 |
!!!cp ('t344'); |
!!!cp ('t344'); |
| 6166 |
!!!back-token; |
!!!back-token; # <form> |
| 6167 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
| 6168 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6169 |
redo B; |
next B; |
| 6170 |
} elsif ({ |
} elsif ($_->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
| 6171 |
!!!cp ('t345'); |
!!!cp ('t345'); |
| 6172 |
last INSCOPE; |
last INSCOPE; |
| 6173 |
} |
} |
| 6175 |
|
|
| 6176 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 6177 |
if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') { |
if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') { |
| 6178 |
|
!!!nack ('t346.1'); |
| 6179 |
!!!next-token; |
!!!next-token; |
| 6180 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 6181 |
$token->{data} =~ s/^\x0A//; |
$token->{data} =~ s/^\x0A//; |
| 6192 |
!!!cp ('t347.1'); |
!!!cp ('t347.1'); |
| 6193 |
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
$self->{form_element} = $self->{open_elements}->[-1]->[0]; |
| 6194 |
|
|
| 6195 |
|
!!!nack ('t347.2'); |
| 6196 |
!!!next-token; |
!!!next-token; |
| 6197 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
| 6198 |
!!!cp ('t382'); |
!!!cp ('t382'); |
| 6200 |
|
|
| 6201 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
| 6202 |
|
|
| 6203 |
|
!!!nack ('t382.1'); |
| 6204 |
!!!next-token; |
!!!next-token; |
| 6205 |
} elsif ($token->{tag_name} eq 'hr') { |
} elsif ($token->{tag_name} eq 'hr') { |
| 6206 |
!!!cp ('t386'); |
!!!cp ('t386'); |
| 6207 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 6208 |
|
|
| 6209 |
|
!!!nack ('t386.1'); |
| 6210 |
!!!next-token; |
!!!next-token; |
| 6211 |
} else { |
} else { |
| 6212 |
!!!cp ('t347'); |
!!!nack ('t347.1'); |
| 6213 |
!!!next-token; |
!!!next-token; |
| 6214 |
} |
} |
| 6215 |
redo B; |
next B; |
| 6216 |
} elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) { |
} elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) { |
| 6217 |
## has a p element in scope |
## has a p element in scope |
| 6218 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 6219 |
if ($_->[1] eq 'p') { |
if ($_->[1] & P_EL) { |
| 6220 |
!!!cp ('t353'); |
!!!cp ('t353'); |
| 6221 |
!!!back-token; |
!!!back-token; # <x> |
| 6222 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
| 6223 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6224 |
redo B; |
next B; |
| 6225 |
} elsif ({ |
} elsif ($_->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
| 6226 |
!!!cp ('t354'); |
!!!cp ('t354'); |
| 6227 |
last INSCOPE; |
last INSCOPE; |
| 6228 |
} |
} |
| 6236 |
dd => {dt => 1, dd => 1}}->{$token->{tag_name}}; |
dd => {dt => 1, dd => 1}}->{$token->{tag_name}}; |
| 6237 |
LI: { |
LI: { |
| 6238 |
## Step 2 |
## Step 2 |
| 6239 |
if ($li_or_dtdd->{$node->[1]}) { |
if ($li_or_dtdd->{$node->[0]->manakai_local_name}) { |
| 6240 |
if ($i != -1) { |
if ($i != -1) { |
| 6241 |
!!!cp ('t355'); |
!!!cp ('t355'); |
| 6242 |
!!!parse-error (type => 'end tag missing:'. |
!!!parse-error (type => 'not closed', |
| 6243 |
$self->{open_elements}->[-1]->[1], token => $token); |
value => $self->{open_elements}->[-1]->[0] |
| 6244 |
|
->manakai_local_name, |
| 6245 |
|
token => $token); |
| 6246 |
} else { |
} else { |
| 6247 |
!!!cp ('t356'); |
!!!cp ('t356'); |
| 6248 |
} |
} |
| 6253 |
} |
} |
| 6254 |
|
|
| 6255 |
## Step 3 |
## Step 3 |
| 6256 |
if (not $formatting_category->{$node->[1]} and |
if (not ($node->[1] & FORMATTING_EL) and |
| 6257 |
#not $phrasing_category->{$node->[1]} and |
#not $phrasing_category->{$node->[1]} and |
| 6258 |
($special_category->{$node->[1]} or |
($node->[1] & SPECIAL_EL or |
| 6259 |
$scoping_category->{$node->[1]}) and |
$node->[1] & SCOPING_EL) and |
| 6260 |
$node->[1] ne 'address' and $node->[1] ne 'div') { |
not ($node->[1] & ADDRESS_EL) and |
| 6261 |
|
not ($node->[1] & DIV_EL)) { |
| 6262 |
!!!cp ('t358'); |
!!!cp ('t358'); |
| 6263 |
last LI; |
last LI; |
| 6264 |
} |
} |
| 6271 |
} # LI |
} # LI |
| 6272 |
|
|
| 6273 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 6274 |
|
!!!nack ('t359.1'); |
| 6275 |
!!!next-token; |
!!!next-token; |
| 6276 |
redo B; |
next B; |
| 6277 |
} elsif ($token->{tag_name} eq 'plaintext') { |
} elsif ($token->{tag_name} eq 'plaintext') { |
| 6278 |
## has a p element in scope |
## has a p element in scope |
| 6279 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
| 6280 |
if ($_->[1] eq 'p') { |
if ($_->[1] & P_EL) { |
| 6281 |
!!!cp ('t367'); |
!!!cp ('t367'); |
| 6282 |
!!!back-token; |
!!!back-token; # <plaintext> |
| 6283 |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
$token = {type => END_TAG_TOKEN, tag_name => 'p', |
| 6284 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6285 |
redo B; |
next B; |
| 6286 |
} elsif ({ |
} elsif ($_->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
| 6287 |
!!!cp ('t368'); |
!!!cp ('t368'); |
| 6288 |
last INSCOPE; |
last INSCOPE; |
| 6289 |
} |
} |
| 6293 |
|
|
| 6294 |
$self->{content_model} = PLAINTEXT_CONTENT_MODEL; |
$self->{content_model} = PLAINTEXT_CONTENT_MODEL; |
| 6295 |
|
|
| 6296 |
|
!!!nack ('t368.1'); |
| 6297 |
!!!next-token; |
!!!next-token; |
| 6298 |
redo B; |
next B; |
| 6299 |
} elsif ($token->{tag_name} eq 'a') { |
} elsif ($token->{tag_name} eq 'a') { |
| 6300 |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
| 6301 |
my $node = $active_formatting_elements->[$i]; |
my $node = $active_formatting_elements->[$i]; |
| 6302 |
if ($node->[1] eq 'a') { |
if ($node->[1] & A_EL) { |
| 6303 |
!!!cp ('t371'); |
!!!cp ('t371'); |
| 6304 |
!!!parse-error (type => 'in a:a', token => $token); |
!!!parse-error (type => 'in a:a', token => $token); |
| 6305 |
|
|
| 6306 |
!!!back-token; |
!!!back-token; # <a> |
| 6307 |
$token = {type => END_TAG_TOKEN, tag_name => 'a', |
$token = {type => END_TAG_TOKEN, tag_name => 'a', |
| 6308 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6309 |
$formatting_end_tag->($token); |
$formatting_end_tag->($token); |
| 6334 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 6335 |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
| 6336 |
|
|
| 6337 |
|
!!!nack ('t374.1'); |
| 6338 |
!!!next-token; |
!!!next-token; |
| 6339 |
redo B; |
next B; |
| 6340 |
} elsif ($token->{tag_name} eq 'nobr') { |
} elsif ($token->{tag_name} eq 'nobr') { |
| 6341 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 6342 |
|
|
| 6343 |
## has a |nobr| element in scope |
## has a |nobr| element in scope |
| 6344 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 6345 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 6346 |
if ($node->[1] eq 'nobr') { |
if ($node->[1] & NOBR_EL) { |
| 6347 |
!!!cp ('t376'); |
!!!cp ('t376'); |
| 6348 |
!!!parse-error (type => 'in nobr:nobr', token => $token); |
!!!parse-error (type => 'in nobr:nobr', token => $token); |
| 6349 |
!!!back-token; |
!!!back-token; # <nobr> |
| 6350 |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr', |
| 6351 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6352 |
redo B; |
next B; |
| 6353 |
} elsif ({ |
} elsif ($node->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 6354 |
!!!cp ('t377'); |
!!!cp ('t377'); |
| 6355 |
last INSCOPE; |
last INSCOPE; |
| 6356 |
} |
} |
| 6359 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token); |
| 6360 |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
| 6361 |
|
|
| 6362 |
|
!!!nack ('t377.1'); |
| 6363 |
!!!next-token; |
!!!next-token; |
| 6364 |
redo B; |
next B; |
| 6365 |
} elsif ($token->{tag_name} eq 'button') { |
} elsif ($token->{tag_name} eq 'button') { |
| 6366 |
## has a button element in scope |
## has a button element in scope |
| 6367 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 6368 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 6369 |
if ($node->[1] eq 'button') { |
if ($node->[1] & BUTTON_EL) { |
| 6370 |
!!!cp ('t378'); |
!!!cp ('t378'); |
| 6371 |
!!!parse-error (type => 'in button:button', token => $token); |
!!!parse-error (type => 'in button:button', token => $token); |
| 6372 |
!!!back-token; |
!!!back-token; # <button> |
| 6373 |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
$token = {type => END_TAG_TOKEN, tag_name => 'button', |
| 6374 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6375 |
redo B; |
next B; |
| 6376 |
} elsif ({ |
} elsif ($node->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 6377 |
!!!cp ('t379'); |
!!!cp ('t379'); |
| 6378 |
last INSCOPE; |
last INSCOPE; |
| 6379 |
} |
} |
| 6387 |
|
|
| 6388 |
push @$active_formatting_elements, ['#marker', '']; |
push @$active_formatting_elements, ['#marker', '']; |
| 6389 |
|
|
| 6390 |
|
!!!nack ('t379.1'); |
| 6391 |
!!!next-token; |
!!!next-token; |
| 6392 |
redo B; |
next B; |
| 6393 |
} elsif ({ |
} elsif ({ |
| 6394 |
xmp => 1, |
xmp => 1, |
| 6395 |
iframe => 1, |
iframe => 1, |
| 6405 |
} |
} |
| 6406 |
## NOTE: There is an "as if in body" code clone. |
## NOTE: There is an "as if in body" code clone. |
| 6407 |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
| 6408 |
redo B; |
next B; |
| 6409 |
} elsif ($token->{tag_name} eq 'isindex') { |
} elsif ($token->{tag_name} eq 'isindex') { |
| 6410 |
!!!parse-error (type => 'isindex', token => $token); |
!!!parse-error (type => 'isindex', token => $token); |
| 6411 |
|
|
| 6412 |
if (defined $self->{form_element}) { |
if (defined $self->{form_element}) { |
| 6413 |
!!!cp ('t389'); |
!!!cp ('t389'); |
| 6414 |
## Ignore the token |
## Ignore the token |
| 6415 |
|
!!!nack ('t389'); ## NOTE: Not acknowledged. |
| 6416 |
!!!next-token; |
!!!next-token; |
| 6417 |
redo B; |
next B; |
| 6418 |
} else { |
} else { |
| 6419 |
my $at = $token->{attributes}; |
my $at = $token->{attributes}; |
| 6420 |
my $form_attrs; |
my $form_attrs; |
| 6459 |
line => $token->{line}, column => $token->{column}}, |
line => $token->{line}, column => $token->{column}}, |
| 6460 |
{type => END_TAG_TOKEN, tag_name => 'form', |
{type => END_TAG_TOKEN, tag_name => 'form', |
| 6461 |
line => $token->{line}, column => $token->{column}}; |
line => $token->{line}, column => $token->{column}}; |
| 6462 |
$token = shift @tokens; |
!!!nack ('t391.1'); ## NOTE: Not acknowledged. |
| 6463 |
!!!back-token (@tokens); |
!!!back-token (@tokens); |
| 6464 |
redo B; |
!!!next-token; |
| 6465 |
|
next B; |
| 6466 |
} |
} |
| 6467 |
} elsif ($token->{tag_name} eq 'textarea') { |
} elsif ($token->{tag_name} eq 'textarea') { |
| 6468 |
my $tag_name = $token->{tag_name}; |
my $tag_name = $token->{tag_name}; |
| 6469 |
my $el; |
my $el; |
| 6470 |
!!!create-element ($el, $token->{tag_name}, $token->{attributes}, $token); |
!!!create-element ($el, $HTML_NS, $token->{tag_name}, $token->{attributes}, $token); |
| 6471 |
|
|
| 6472 |
## TODO: $self->{form_element} if defined |
## TODO: $self->{form_element} if defined |
| 6473 |
$self->{content_model} = RCDATA_CONTENT_MODEL; |
$self->{content_model} = RCDATA_CONTENT_MODEL; |
| 6476 |
$insert->($el); |
$insert->($el); |
| 6477 |
|
|
| 6478 |
my $text = ''; |
my $text = ''; |
| 6479 |
|
!!!nack ('t392.1'); |
| 6480 |
!!!next-token; |
!!!next-token; |
| 6481 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 6482 |
$token->{data} =~ s/^\x0A//; |
$token->{data} =~ s/^\x0A//; |
| 6510 |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}, token => $token); |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}, token => $token); |
| 6511 |
} |
} |
| 6512 |
!!!next-token; |
!!!next-token; |
| 6513 |
redo B; |
next B; |
| 6514 |
|
} elsif ($token->{tag_name} eq 'math' or |
| 6515 |
|
$token->{tag_name} eq 'svg') { |
| 6516 |
|
$reconstruct_active_formatting_elements->($insert_to_current); |
| 6517 |
|
|
| 6518 |
|
## "adjust SVG attributes" ('svg' only) - done in insert-element-f |
| 6519 |
|
|
| 6520 |
|
## "adjust foreign attributes" - done in insert-element-f |
| 6521 |
|
|
| 6522 |
|
!!!insert-element-f ($token->{tag_name} eq 'math' ? $MML_NS : $SVG_NS, $token->{tag_name}, $token->{attributes}, $token); |
| 6523 |
|
|
| 6524 |
|
if ($self->{self_closing}) { |
| 6525 |
|
pop @{$self->{open_elements}}; |
| 6526 |
|
!!!ack ('t398.1'); |
| 6527 |
|
} else { |
| 6528 |
|
!!!cp ('t398.2'); |
| 6529 |
|
$self->{insertion_mode} |= IN_FOREIGN_CONTENT_IM; |
| 6530 |
|
## NOTE: |<body><math><mi><svg>| -> "in foreign content" insertion |
| 6531 |
|
## mode, "in body" (not "in foreign content") secondary insertion |
| 6532 |
|
## mode, maybe. |
| 6533 |
|
} |
| 6534 |
|
|
| 6535 |
|
!!!next-token; |
| 6536 |
|
next B; |
| 6537 |
} elsif ({ |
} elsif ({ |
| 6538 |
caption => 1, col => 1, colgroup => 1, frame => 1, |
caption => 1, col => 1, colgroup => 1, frame => 1, |
| 6539 |
frameset => 1, head => 1, option => 1, optgroup => 1, |
frameset => 1, head => 1, option => 1, optgroup => 1, |
| 6543 |
!!!cp ('t401'); |
!!!cp ('t401'); |
| 6544 |
!!!parse-error (type => 'in body:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in body:'.$token->{tag_name}, token => $token); |
| 6545 |
## Ignore the token |
## Ignore the token |
| 6546 |
|
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
| 6547 |
!!!next-token; |
!!!next-token; |
| 6548 |
redo B; |
next B; |
| 6549 |
|
|
| 6550 |
## ISSUE: An issue on HTML5 new elements in the spec. |
## ISSUE: An issue on HTML5 new elements in the spec. |
| 6551 |
} else { |
} else { |
| 6567 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6568 |
!!!cp ('t380'); |
!!!cp ('t380'); |
| 6569 |
push @$active_formatting_elements, ['#marker', '']; |
push @$active_formatting_elements, ['#marker', '']; |
| 6570 |
|
!!!nack ('t380.1'); |
| 6571 |
} elsif ({ |
} elsif ({ |
| 6572 |
b => 1, big => 1, em => 1, font => 1, i => 1, |
b => 1, big => 1, em => 1, font => 1, i => 1, |
| 6573 |
s => 1, small => 1, strile => 1, |
s => 1, small => 1, strile => 1, |
| 6575 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6576 |
!!!cp ('t375'); |
!!!cp ('t375'); |
| 6577 |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
push @$active_formatting_elements, $self->{open_elements}->[-1]; |
| 6578 |
|
!!!nack ('t375.1'); |
| 6579 |
} elsif ($token->{tag_name} eq 'input') { |
} elsif ($token->{tag_name} eq 'input') { |
| 6580 |
!!!cp ('t388'); |
!!!cp ('t388'); |
| 6581 |
## TODO: associate with $self->{form_element} if defined |
## TODO: associate with $self->{form_element} if defined |
| 6582 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 6583 |
|
!!!ack ('t388.2'); |
| 6584 |
} elsif ({ |
} elsif ({ |
| 6585 |
area => 1, basefont => 1, bgsound => 1, br => 1, |
area => 1, basefont => 1, bgsound => 1, br => 1, |
| 6586 |
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
embed => 1, img => 1, param => 1, spacer => 1, wbr => 1, |
| 6588 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6589 |
!!!cp ('t388.1'); |
!!!cp ('t388.1'); |
| 6590 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 6591 |
|
!!!ack ('t388.3'); |
| 6592 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
| 6593 |
## TODO: associate with $self->{form_element} if defined |
## TODO: associate with $self->{form_element} if defined |
| 6594 |
|
|
| 6601 |
!!!cp ('t400.2'); |
!!!cp ('t400.2'); |
| 6602 |
$self->{insertion_mode} = IN_SELECT_IM; |
$self->{insertion_mode} = IN_SELECT_IM; |
| 6603 |
} |
} |
| 6604 |
|
!!!nack ('t400.3'); |
| 6605 |
} else { |
} else { |
| 6606 |
!!!cp ('t402'); |
!!!nack ('t402'); |
| 6607 |
} |
} |
| 6608 |
|
|
| 6609 |
!!!next-token; |
!!!next-token; |
| 6610 |
redo B; |
next B; |
| 6611 |
} |
} |
| 6612 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
| 6613 |
if ($token->{tag_name} eq 'body') { |
if ($token->{tag_name} eq 'body') { |
| 6615 |
my $i; |
my $i; |
| 6616 |
INSCOPE: { |
INSCOPE: { |
| 6617 |
for (reverse @{$self->{open_elements}}) { |
for (reverse @{$self->{open_elements}}) { |
| 6618 |
if ($_->[1] eq 'body') { |
if ($_->[1] & BODY_EL) { |
| 6619 |
!!!cp ('t405'); |
!!!cp ('t405'); |
| 6620 |
$i = $_; |
$i = $_; |
| 6621 |
last INSCOPE; |
last INSCOPE; |
| 6622 |
} elsif ({ |
} elsif ($_->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$_->[1]}) { |
|
| 6623 |
!!!cp ('t405.1'); |
!!!cp ('t405.1'); |
| 6624 |
last; |
last; |
| 6625 |
} |
} |
| 6629 |
value => $token->{tag_name}, token => $token); |
value => $token->{tag_name}, token => $token); |
| 6630 |
## NOTE: Ignore the token. |
## NOTE: Ignore the token. |
| 6631 |
!!!next-token; |
!!!next-token; |
| 6632 |
redo B; |
next B; |
| 6633 |
} # INSCOPE |
} # INSCOPE |
| 6634 |
|
|
| 6635 |
for (@{$self->{open_elements}}) { |
for (@{$self->{open_elements}}) { |
| 6636 |
unless ({ |
unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL) { |
|
dd => 1, dt => 1, li => 1, p => 1, td => 1, |
|
|
th => 1, tr => 1, body => 1, html => 1, |
|
|
tbody => 1, tfoot => 1, thead => 1, |
|
|
}->{$_->[1]}) { |
|
| 6637 |
!!!cp ('t403'); |
!!!cp ('t403'); |
| 6638 |
!!!parse-error (type => 'not closed:'.$_->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 6639 |
|
value => $_->[0]->manakai_local_name, |
| 6640 |
|
token => $token); |
| 6641 |
last; |
last; |
| 6642 |
} else { |
} else { |
| 6643 |
!!!cp ('t404'); |
!!!cp ('t404'); |
| 6646 |
|
|
| 6647 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
| 6648 |
!!!next-token; |
!!!next-token; |
| 6649 |
redo B; |
next B; |
| 6650 |
} elsif ($token->{tag_name} eq 'html') { |
} elsif ($token->{tag_name} eq 'html') { |
| 6651 |
if (@{$self->{open_elements}} > 1 and $self->{open_elements}->[1]->[1] eq 'body') { |
## TODO: Update this code. It seems that the code below is not |
| 6652 |
|
## up-to-date, though it has same effect as speced. |
| 6653 |
|
if (@{$self->{open_elements}} > 1 and |
| 6654 |
|
$self->{open_elements}->[1]->[1] & BODY_EL) { |
| 6655 |
## ISSUE: There is an issue in the spec. |
## ISSUE: There is an issue in the spec. |
| 6656 |
if ($self->{open_elements}->[-1]->[1] ne 'body') { |
unless ($self->{open_elements}->[-1]->[1] & BODY_EL) { |
| 6657 |
!!!cp ('t406'); |
!!!cp ('t406'); |
| 6658 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 6659 |
|
value => $self->{open_elements}->[1]->[0] |
| 6660 |
|
->manakai_local_name, |
| 6661 |
|
token => $token); |
| 6662 |
} else { |
} else { |
| 6663 |
!!!cp ('t407'); |
!!!cp ('t407'); |
| 6664 |
} |
} |
| 6665 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
| 6666 |
## reprocess |
## reprocess |
| 6667 |
redo B; |
next B; |
| 6668 |
} else { |
} else { |
| 6669 |
!!!cp ('t408'); |
!!!cp ('t408'); |
| 6670 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 6671 |
## Ignore the token |
## Ignore the token |
| 6672 |
!!!next-token; |
!!!next-token; |
| 6673 |
redo B; |
next B; |
| 6674 |
} |
} |
| 6675 |
} elsif ({ |
} elsif ({ |
| 6676 |
address => 1, blockquote => 1, center => 1, dir => 1, |
address => 1, blockquote => 1, center => 1, dir => 1, |
| 6683 |
my $i; |
my $i; |
| 6684 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 6685 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 6686 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[0]->manakai_local_name eq $token->{tag_name}) { |
| 6687 |
!!!cp ('t410'); |
!!!cp ('t410'); |
| 6688 |
$i = $_; |
$i = $_; |
| 6689 |
last INSCOPE; |
last INSCOPE; |
| 6690 |
} elsif ({ |
} elsif ($node->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 6691 |
!!!cp ('t411'); |
!!!cp ('t411'); |
| 6692 |
last INSCOPE; |
last INSCOPE; |
| 6693 |
} |
} |
| 6703 |
dt => ($token->{tag_name} ne 'dt'), |
dt => ($token->{tag_name} ne 'dt'), |
| 6704 |
li => ($token->{tag_name} ne 'li'), |
li => ($token->{tag_name} ne 'li'), |
| 6705 |
p => 1, |
p => 1, |
| 6706 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[0]->manakai_local_name}) { |
| 6707 |
!!!cp ('t409'); |
!!!cp ('t409'); |
| 6708 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 6709 |
} |
} |
| 6710 |
|
|
| 6711 |
## Step 2. |
## Step 2. |
| 6712 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
| 6713 |
|
ne $token->{tag_name}) { |
| 6714 |
!!!cp ('t412'); |
!!!cp ('t412'); |
| 6715 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 6716 |
|
value => $self->{open_elements}->[-1]->[0] |
| 6717 |
|
->manakai_local_name, |
| 6718 |
|
token => $token); |
| 6719 |
} else { |
} else { |
| 6720 |
!!!cp ('t414'); |
!!!cp ('t414'); |
| 6721 |
} |
} |
| 6730 |
}->{$token->{tag_name}}; |
}->{$token->{tag_name}}; |
| 6731 |
} |
} |
| 6732 |
!!!next-token; |
!!!next-token; |
| 6733 |
redo B; |
next B; |
| 6734 |
} elsif ($token->{tag_name} eq 'form') { |
} elsif ($token->{tag_name} eq 'form') { |
| 6735 |
undef $self->{form_element}; |
undef $self->{form_element}; |
| 6736 |
|
|
| 6738 |
my $i; |
my $i; |
| 6739 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 6740 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 6741 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] & FORM_EL) { |
| 6742 |
!!!cp ('t418'); |
!!!cp ('t418'); |
| 6743 |
$i = $_; |
$i = $_; |
| 6744 |
last INSCOPE; |
last INSCOPE; |
| 6745 |
} elsif ({ |
} elsif ($node->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 6746 |
!!!cp ('t419'); |
!!!cp ('t419'); |
| 6747 |
last INSCOPE; |
last INSCOPE; |
| 6748 |
} |
} |
| 6753 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 6754 |
} else { |
} else { |
| 6755 |
## Step 1. generate implied end tags |
## Step 1. generate implied end tags |
| 6756 |
while ({ |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
|
dd => 1, dt => 1, li => 1, p => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 6757 |
!!!cp ('t417'); |
!!!cp ('t417'); |
| 6758 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 6759 |
} |
} |
| 6760 |
|
|
| 6761 |
## Step 2. |
## Step 2. |
| 6762 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
| 6763 |
|
ne $token->{tag_name}) { |
| 6764 |
!!!cp ('t417.1'); |
!!!cp ('t417.1'); |
| 6765 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 6766 |
|
value => $self->{open_elements}->[-1]->[0] |
| 6767 |
|
->manakai_local_name, |
| 6768 |
|
token => $token); |
| 6769 |
} else { |
} else { |
| 6770 |
!!!cp ('t420'); |
!!!cp ('t420'); |
| 6771 |
} |
} |
| 6775 |
} |
} |
| 6776 |
|
|
| 6777 |
!!!next-token; |
!!!next-token; |
| 6778 |
redo B; |
next B; |
| 6779 |
} elsif ({ |
} elsif ({ |
| 6780 |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
| 6781 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6783 |
my $i; |
my $i; |
| 6784 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 6785 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 6786 |
if ({ |
if ($node->[1] & HEADING_EL) { |
|
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
|
|
}->{$node->[1]}) { |
|
| 6787 |
!!!cp ('t423'); |
!!!cp ('t423'); |
| 6788 |
$i = $_; |
$i = $_; |
| 6789 |
last INSCOPE; |
last INSCOPE; |
| 6790 |
} elsif ({ |
} elsif ($node->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 6791 |
!!!cp ('t424'); |
!!!cp ('t424'); |
| 6792 |
last INSCOPE; |
last INSCOPE; |
| 6793 |
} |
} |
| 6798 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 6799 |
} else { |
} else { |
| 6800 |
## Step 1. generate implied end tags |
## Step 1. generate implied end tags |
| 6801 |
while ({ |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
|
dd => 1, dt => 1, li => 1, p => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 6802 |
!!!cp ('t422'); |
!!!cp ('t422'); |
| 6803 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 6804 |
} |
} |
| 6805 |
|
|
| 6806 |
## Step 2. |
## Step 2. |
| 6807 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
| 6808 |
|
ne $token->{tag_name}) { |
| 6809 |
!!!cp ('t425'); |
!!!cp ('t425'); |
| 6810 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 6811 |
} else { |
} else { |
| 6817 |
} |
} |
| 6818 |
|
|
| 6819 |
!!!next-token; |
!!!next-token; |
| 6820 |
redo B; |
next B; |
| 6821 |
} elsif ($token->{tag_name} eq 'p') { |
} elsif ($token->{tag_name} eq 'p') { |
| 6822 |
## has an element in scope |
## has an element in scope |
| 6823 |
my $i; |
my $i; |
| 6824 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 6825 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 6826 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] & P_EL) { |
| 6827 |
!!!cp ('t410.1'); |
!!!cp ('t410.1'); |
| 6828 |
$i = $_; |
$i = $_; |
| 6829 |
last INSCOPE; |
last INSCOPE; |
| 6830 |
} elsif ({ |
} elsif ($node->[1] & SCOPING_EL) { |
|
applet => 1, table => 1, caption => 1, td => 1, th => 1, |
|
|
button => 1, marquee => 1, object => 1, html => 1, |
|
|
}->{$node->[1]}) { |
|
| 6831 |
!!!cp ('t411.1'); |
!!!cp ('t411.1'); |
| 6832 |
last INSCOPE; |
last INSCOPE; |
| 6833 |
} |
} |
| 6834 |
} # INSCOPE |
} # INSCOPE |
| 6835 |
|
|
| 6836 |
if (defined $i) { |
if (defined $i) { |
| 6837 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
| 6838 |
|
ne $token->{tag_name}) { |
| 6839 |
!!!cp ('t412.1'); |
!!!cp ('t412.1'); |
| 6840 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 6841 |
|
value => $self->{open_elements}->[-1]->[0] |
| 6842 |
|
->manakai_local_name, |
| 6843 |
|
token => $token); |
| 6844 |
} else { |
} else { |
| 6845 |
!!!cp ('t414.1'); |
!!!cp ('t414.1'); |
| 6846 |
} |
} |
| 6853 |
!!!cp ('t415.1'); |
!!!cp ('t415.1'); |
| 6854 |
## As if <p>, then reprocess the current token |
## As if <p>, then reprocess the current token |
| 6855 |
my $el; |
my $el; |
| 6856 |
!!!create-element ($el, 'p',, $token); |
!!!create-element ($el, $HTML_NS, 'p',, $token); |
| 6857 |
$insert->($el); |
$insert->($el); |
| 6858 |
## NOTE: Not inserted into |$self->{open_elements}|. |
## NOTE: Not inserted into |$self->{open_elements}|. |
| 6859 |
} |
} |
| 6860 |
|
|
| 6861 |
!!!next-token; |
!!!next-token; |
| 6862 |
redo B; |
next B; |
| 6863 |
} elsif ({ |
} elsif ({ |
| 6864 |
a => 1, |
a => 1, |
| 6865 |
b => 1, big => 1, em => 1, font => 1, i => 1, |
b => 1, big => 1, em => 1, font => 1, i => 1, |
| 6868 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
| 6869 |
!!!cp ('t427'); |
!!!cp ('t427'); |
| 6870 |
$formatting_end_tag->($token); |
$formatting_end_tag->($token); |
| 6871 |
redo B; |
next B; |
| 6872 |
} elsif ($token->{tag_name} eq 'br') { |
} elsif ($token->{tag_name} eq 'br') { |
| 6873 |
!!!cp ('t428'); |
!!!cp ('t428'); |
| 6874 |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
| 6877 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
| 6878 |
|
|
| 6879 |
my $el; |
my $el; |
| 6880 |
!!!create-element ($el, 'br',, $token); |
!!!create-element ($el, $HTML_NS, 'br',, $token); |
| 6881 |
$insert->($el); |
$insert->($el); |
| 6882 |
|
|
| 6883 |
## Ignore the token. |
## Ignore the token. |
| 6884 |
!!!next-token; |
!!!next-token; |
| 6885 |
redo B; |
next B; |
| 6886 |
} elsif ({ |
} elsif ({ |
| 6887 |
caption => 1, col => 1, colgroup => 1, frame => 1, |
caption => 1, col => 1, colgroup => 1, frame => 1, |
| 6888 |
frameset => 1, head => 1, option => 1, optgroup => 1, |
frameset => 1, head => 1, option => 1, optgroup => 1, |
| 6899 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 6900 |
## Ignore the token |
## Ignore the token |
| 6901 |
!!!next-token; |
!!!next-token; |
| 6902 |
redo B; |
next B; |
| 6903 |
|
|
| 6904 |
## ISSUE: Issue on HTML5 new elements in spec |
## ISSUE: Issue on HTML5 new elements in spec |
| 6905 |
|
|
| 6910 |
|
|
| 6911 |
## Step 2 |
## Step 2 |
| 6912 |
S2: { |
S2: { |
| 6913 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[0]->manakai_local_name eq $token->{tag_name}) { |
| 6914 |
## Step 1 |
## Step 1 |
| 6915 |
## generate implied end tags |
## generate implied end tags |
| 6916 |
while ({ |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
|
dd => 1, dt => 1, li => 1, p => 1, |
|
|
}->{$self->{open_elements}->[-1]->[1]}) { |
|
| 6917 |
!!!cp ('t430'); |
!!!cp ('t430'); |
| 6918 |
## ISSUE: Can this case be reached? |
## ISSUE: Can this case be reached? |
| 6919 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
| 6920 |
} |
} |
| 6921 |
|
|
| 6922 |
## Step 2 |
## Step 2 |
| 6923 |
if ($token->{tag_name} ne $self->{open_elements}->[-1]->[1]) { |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
| 6924 |
|
ne $token->{tag_name}) { |
| 6925 |
!!!cp ('t431'); |
!!!cp ('t431'); |
| 6926 |
## NOTE: <x><y></x> |
## NOTE: <x><y></x> |
| 6927 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1], token => $token); |
!!!parse-error (type => 'not closed', |
| 6928 |
|
value => $self->{open_elements}->[-1]->[0] |
| 6929 |
|
->manakai_local_name, |
| 6930 |
|
token => $token); |
| 6931 |
} else { |
} else { |
| 6932 |
!!!cp ('t432'); |
!!!cp ('t432'); |
| 6933 |
} |
} |
| 6939 |
last S2; |
last S2; |
| 6940 |
} else { |
} else { |
| 6941 |
## Step 3 |
## Step 3 |
| 6942 |
if (not $formatting_category->{$node->[1]} and |
if (not ($node->[1] & FORMATTING_EL) and |
| 6943 |
#not $phrasing_category->{$node->[1]} and |
#not $phrasing_category->{$node->[1]} and |
| 6944 |
($special_category->{$node->[1]} or |
($node->[1] & SPECIAL_EL or |
| 6945 |
$scoping_category->{$node->[1]})) { |
$node->[1] & SCOPING_EL)) { |
| 6946 |
!!!cp ('t433'); |
!!!cp ('t433'); |
| 6947 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
| 6948 |
## Ignore the token |
## Ignore the token |
| 6960 |
## Step 5; |
## Step 5; |
| 6961 |
redo S2; |
redo S2; |
| 6962 |
} # S2 |
} # S2 |
| 6963 |
redo B; |
next B; |
| 6964 |
} |
} |
| 6965 |
} |
} |
| 6966 |
redo B; |
next B; |
| 6967 |
|
} continue { # B |
| 6968 |
|
if ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM) { |
| 6969 |
|
## NOTE: The code below is executed in cases where it does not have |
| 6970 |
|
## to be, but it it is harmless even in those cases. |
| 6971 |
|
## has an element in scope |
| 6972 |
|
INSCOPE: { |
| 6973 |
|
for (reverse 0..$#{$self->{open_elements}}) { |
| 6974 |
|
my $node = $self->{open_elements}->[$_]; |
| 6975 |
|
if ($node->[1] & FOREIGN_EL) { |
| 6976 |
|
last INSCOPE; |
| 6977 |
|
} elsif ($node->[1] & SCOPING_EL) { |
| 6978 |
|
last; |
| 6979 |
|
} |
| 6980 |
|
} |
| 6981 |
|
|
| 6982 |
|
## NOTE: No foreign element in scope. |
| 6983 |
|
$self->{insertion_mode} &= ~ IN_FOREIGN_CONTENT_IM; |
| 6984 |
|
} # INSCOPE |
| 6985 |
|
} |
| 6986 |
} # B |
} # B |
| 6987 |
|
|
| 6988 |
## Stop parsing # MUST |
## Stop parsing # MUST |
| 7099 |
unless defined $p->{content_model}; |
unless defined $p->{content_model}; |
| 7100 |
## ISSUE: What is "the name of the element"? local name? |
## ISSUE: What is "the name of the element"? local name? |
| 7101 |
|
|
| 7102 |
$p->{inner_html_node} = [$node, $node_ln]; |
$p->{inner_html_node} = [$node, $el_category->{$node_ln}]; |
| 7103 |
|
## TODO: Foreign element OK? |
| 7104 |
|
|
| 7105 |
## Step 3 |
## Step 3 |
| 7106 |
my $root = $doc->create_element_ns |
my $root = $doc->create_element_ns |
| 7110 |
$doc->append_child ($root); |
$doc->append_child ($root); |
| 7111 |
|
|
| 7112 |
## Step 5 # MUST |
## Step 5 # MUST |
| 7113 |
push @{$p->{open_elements}}, [$root, 'html']; |
push @{$p->{open_elements}}, [$root, $el_category->{html}]; |
| 7114 |
|
|
| 7115 |
undef $p->{head_element}; |
undef $p->{head_element}; |
| 7116 |
|
|