@@ -1087,13 +1087,15 @@ def __init__(self, parser, tree):
1087
1087
def clearStackToTableContext (self ):
1088
1088
# "clear the stack back to a table context"
1089
1089
while self .tree .openElements [- 1 ].name not in ("table" , "html" ):
1090
+ self .parser .parseError (_ (u"Unexpected implied end tag (" + \
1091
+ self .tree .openElements [- 1 ].name + u") in the table phase." ))
1090
1092
self .tree .openElements .pop ()
1091
- self .parser .parseError ()
1092
1093
# When the current node is <html> it's an innerHTML case
1093
1094
1094
1095
# processing methods
1095
1096
def processCharacters (self , data ):
1096
- self .parser .parseError ()
1097
+ self .parser .parseError (_ (u"Unexpected non-space characters in "
1098
+ u"table context caused voodoo mode." ))
1097
1099
# Make all the special element rearranging voodoo kick in
1098
1100
self .tree .insertFromTable = True
1099
1101
# Process the character in the "in body" mode
@@ -1131,7 +1133,8 @@ def startTagTable(self, name, attributes):
1131
1133
self .parser .phase .processStartTag (name , attributes )
1132
1134
1133
1135
def startTagOther (self , name , attributes ):
1134
- self .parser .parseError ()
1136
+ self .parser .parseError (_ (u"Unexpected start tag (" + name + u") in "
1137
+ u"table context caused voodoo mode." ))
1135
1138
# Make all the special element rearranging voodoo kick in
1136
1139
self .tree .insertFromTable = True
1137
1140
# Process the start tag in the "in body" mode
@@ -1156,6 +1159,8 @@ def endTagIgnore(self, name):
1156
1159
"). Ignored." ))
1157
1160
1158
1161
def endTagOther (self , name ):
1162
+ self .parser .parseError (_ (u"Unexpected end tag (" + name + u") in "
1163
+ u"table context caused voodoo mode." ))
1159
1164
# Make all the special element rearranging voodoo kick in
1160
1165
self .parser .insertFromTable = True
1161
1166
# Process the end tag in the "in body" mode
@@ -1270,7 +1275,8 @@ def endTagColgroup(self, name):
1270
1275
self .parser .phase = self .parser .phases ["inTable" ]
1271
1276
1272
1277
def endTagCol (self , name ):
1273
- self .parser .parseError ()
1278
+ self .parser .parseError (_ (u"Unexpected end tag (col). "
1279
+ u"col has no end tag." ))
1274
1280
1275
1281
def endTagOther (self , name ):
1276
1282
self .endTagColgroup ("colgroup" )
@@ -1303,8 +1309,9 @@ def __init__(self, parser, tree):
1303
1309
def clearStackToTableBodyContext (self ):
1304
1310
while self .tree .openElements [- 1 ].name not in ("tbody" , "tfoot" ,
1305
1311
"thead" , "html" ):
1312
+ self .parser .parseError (_ (u"Unexpected implied end tag (" + \
1313
+ self .tree .openElements [- 1 ].name + u") in the table body phase." ))
1306
1314
self .tree .openElements .pop ()
1307
- self .parser .parseError ()
1308
1315
1309
1316
# the rest
1310
1317
def processCharacters (self ,data ):
@@ -1316,7 +1323,8 @@ def startTagTr(self, name, attributes):
1316
1323
self .parser .phase = self .parser .phases ["inRow" ]
1317
1324
1318
1325
def startTagTableCell (self , name , attributes ):
1319
- self .parser .parseError ()
1326
+ self .parser .parseError (_ (u"Unexpected table cell start tag (" + \
1327
+ name + u") in the table body phase. Ignored." ))
1320
1328
self .startTagTr ("tr" , {})
1321
1329
self .parser .phase .processStartTag (name , attributes )
1322
1330
@@ -1341,7 +1349,8 @@ def endTagTableRowGroup(self, name):
1341
1349
self .tree .openElements .pop ()
1342
1350
self .parser .phase = self .parser .phases ["inTable" ]
1343
1351
else :
1344
- self .parser .parseError ()
1352
+ self .parser .parseError (_ ("Unexpected end tag (" + name + \
1353
+ ") in the table body phase. Ignored." ))
1345
1354
1346
1355
def endTagTable (self , name ):
1347
1356
if self .tree .elementInScope ("tbody" , True ) or \
@@ -1356,7 +1365,7 @@ def endTagTable(self, name):
1356
1365
1357
1366
def endTagIgnore (self , name ):
1358
1367
self .parser .parseError (_ ("Unexpected end tag (" + name + \
1359
- "). Ignored." ))
1368
+ ") in the table body phase . Ignored." ))
1360
1369
1361
1370
def endTagOther (self , name ):
1362
1371
self .parser .phases ["inTable" ].processEndTag (name )
@@ -1386,8 +1395,9 @@ def __init__(self, parser, tree):
1386
1395
# helper methods (XXX unify this with other table helper methods)
1387
1396
def clearStackToTableRowContext (self ):
1388
1397
while self .tree .openElements [- 1 ].name not in ("tr" , "html" ):
1398
+ self .parser .parseError (_ (u"Unexpected implied end tag (" + \
1399
+ self .tree .openElements [- 1 ].name + u") in the row phase." ))
1389
1400
self .tree .openElements .pop ()
1390
- self .parser .parseError ()
1391
1401
1392
1402
# the rest
1393
1403
def processCharacters (self , data ):
@@ -1434,7 +1444,7 @@ def endTagTableRowGroup(self, name):
1434
1444
1435
1445
def endTagIgnore (self , name ):
1436
1446
self .parser .parseError (_ ("Unexpected end tag (" + name + \
1437
- ") . Ignored." ))
1447
+ u") in the row phase . Ignored." ))
1438
1448
1439
1449
def endTagOther (self , name ):
1440
1450
self .parser .phases ["inTable" ].processEndTag (name )
@@ -1488,7 +1498,7 @@ def endTagTableCell(self, name):
1488
1498
if self .tree .elementInScope (name , True ):
1489
1499
self .tree .generateImpliedEndTags (name )
1490
1500
if self .tree .openElements [- 1 ].name != name :
1491
- self .parser .parseError ("Got end tag (" + name + \
1501
+ self .parser .parseError ("Got table cell end tag (" + name + \
1492
1502
") while required end tags are missing." )
1493
1503
while True :
1494
1504
node = self .tree .openElements .pop ()
@@ -1560,7 +1570,8 @@ def startTagOptgroup(self, name, attributes):
1560
1570
self .tree .insertElement (name , attributes )
1561
1571
1562
1572
def startTagSelect (self , name , attributes ):
1563
- self .parser .parseError ()
1573
+ self .parser .parseError (_ (u"Unexpected start tag (select) in the "
1574
+ u"select phase implies select start tag." ))
1564
1575
self .endTagSelect ("select" )
1565
1576
1566
1577
def startTagOther (self , name , attributes ):
@@ -1571,7 +1582,8 @@ def endTagOption(self, name):
1571
1582
if self .tree .openElements [- 1 ].name == "option" :
1572
1583
self .tree .openElements .pop ()
1573
1584
else :
1574
- self .parser .parseError ()
1585
+ self .parser .parseError (_ (u"Unexpected end tag (option) in the "
1586
+ u"select phase. Ignored." ))
1575
1587
1576
1588
def endTagOptgroup (self , name ):
1577
1589
# </optgroup> implicitly closes <option>
@@ -1583,7 +1595,8 @@ def endTagOptgroup(self, name):
1583
1595
self .tree .openElements .pop ()
1584
1596
# But nothing else
1585
1597
else :
1586
- self .parser .parseError ()
1598
+ self .parser .parseError (_ (u"Unexpected end tag (optgroup) in the "
1599
+ u"select phase. Ignored." ))
1587
1600
1588
1601
def endTagSelect (self , name ):
1589
1602
if self .tree .elementInScope (name , True ):
@@ -1596,7 +1609,8 @@ def endTagSelect(self, name):
1596
1609
self .parser .parseError ()
1597
1610
1598
1611
def endTagTableElements (self , name ):
1599
- self .parser .parseError ()
1612
+ self .parser .parseError (_ (u"Unexpected table end tag (" + name + \
1613
+ ") in the select phase." ))
1600
1614
if self .tree .elementInScope (name , True ):
1601
1615
self .endTagSelect ()
1602
1616
self .parser .phase .processEndTag (name )
0 commit comments