8000 Start fixing AAA · awesome-python/html5lib-python@ef2c545 · GitHub
[go: up one dir, main page]

Skip to content

Commit ef2c545

Browse files
committed
Start fixing AAA
--HG-- branch : svgmathml
1 parent 1fa604e commit ef2c545

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

src/html5lib/html5parser.py

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,17 +1348,17 @@ def endTagFormatting(self, token):
13481348
commonAncestor = self.tree.openElements[afeIndex-1]
13491349

13501350
# Step 5
1351-
if furthestBlock.parent:
1352-
furthestBlock.parent.removeChild(furthestBlock)
1351+
#if furthestBlock.parent:
1352+
# furthestBlock.parent.removeChild(furthestBlock)
13531353

1354-
# Step 6
1354+
# Step 5
13551355
# The bookmark is supposed to help us identify where to reinsert
13561356
# nodes in step 12. We have to ensure that we reinsert nodes after
13571357
# the node before the active formatting element. Note the bookmark
13581358
# can move in step 7.4
13591359
bookmark = self.tree.activeFormattingElements.index(afeElement)
13601360

1361-
# Step 7
1361+
# Step 6
13621362
lastNode = node = furthestBlock
13631363
while True:
13641364
# AT replace this with a function and recursion?
@@ -1370,51 +1370,55 @@ def endTagFormatting(self, token):
13701370
node = self.tree.openElements[
13711371
self.tree.openElements.index(node)-1]
13721372
self.tree.openElements.remove(tmpNode)
1373-
# Step 7.3
1373+
# Step 6.3
13741374
if node == afeElement:
13751375
break
1376-
# Step 7.4
1376+
# Step 6.4
13771377
if lastNode == furthestBlock:
1378-
bookmark = self.tree.activeFormattingElements.\
1379-
index(node) + 1
1380-
# Step 7.5
1381-
cite = node.parent
1382-
if node.hasContent():
1383-
clone = node.cloneNode()
1384-
# Replace node with clone
1385-
self.tree.activeFormattingElements[
1386-
self.tree.activeFormattingElements.index(node)] = clone
1387-
self.tree.openElements[
1388-
self.tree.openElements.index(node)] = clone
1389-
node = clone
1378+
bookmark = (self.tree.activeFormattingElements.index(node)
1379+
+ 1)
1380+
# Step 6.5
1381+
#cite = node.parent
1382+
#if node.hasContent():
1383+
clone = node.cloneNode()
1384+
# Replace node with clone
1385+
self.tree.activeFormattingElements[
1386+
self.tree.activeFormattingElements.index(node)] = clone
1387+
self.tree.openElements[
1388+
self.tree.openElements.index(node)] = clone
1389+
node = clone
1390+
13901391
# Step 7.6
13911392
# Remove lastNode from its parents, if any
13921393
if lastNode.parent:
13931394
lastNode.parent.removeChild(lastNode)
13941395
node.appendChild(lastNode)
13951396
# Step 7.7
13961397
lastNode = node
1397-
# End of inner loop
1398+
# End of inner loop
13981399

1399-
# Step 8
1400+
# Step 7
1401+
# Foster parent lastNode if commonAncestor is a
1402+
# table, tbody, tfoot, thead, or tr we need to foster parent the
1403+
# lastNode
14001404
if lastNode.parent:
14011405
lastNode.parent.removeChild(lastNode)
14021406
commonAncestor.appendChild(lastNode)
14031407

1404-
# Step 9
1408+
# Step 8
14051409
clone = afeElement.cloneNode()
14061410

1407-
# Step 10
1411+
# Step 9
14081412
furthestBlock.reparentChildren(clone)
14091413

1410-
# Step 11
1414+
# Step 10
14111415
furthestBlock.appendChild(clone)
14121416

1413-
# Step 12
1417+
# Step 11
14141418
self.tree.activeFormattingElements.remove(afeElement)
14151419
self.tree.activeFormattingElements.insert(bookmark, clone)
14161420

1417-
# Step 13
1421+
# Step 12
14181422
self.tree.openElements.remove(afeElement)
14191423
self.tree.openElements.insert(
14201424
self.tree.openElements.index(furthestBlock) + 1, clone)

0 commit comments

Comments
 (0)
0