Skip to content

Commit 20e2709

Browse files
committed
Update naming in AAA
1 parent f50fb36 commit 20e2709

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/html5lib/html5parser.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ def mainLoop(self):
158158

159159

160160
for token in self.normalizedTokens():
161-
#print self.phase.__class__.__name__
162-
#print token
163161
type = token["type"]
164162
if type == CharactersToken:
165163
self.phase.processCharacters(token)
@@ -1360,26 +1358,28 @@ def endTagFormatting(self, token):
13601358
name = token["name"]
13611359
while True:
13621360
# Step 1 paragraph 1
1363-
afeElement = self.tree.elementInActiveFormattingElements(
1361+
formattingElement = self.tree.elementInActiveFormattingElements(
13641362
token["name"])
1365-
if not afeElement or (afeElement in self.tree.openElements and
1366-
not self.tree.elementInScope(afeElement.name)):
1363+
if not formattingElement or (formattingElement in
1364+
self.tree.openElements and
1365+
not self.tree.elementInScope(
1366+
formattingElement.name)):
13671367
self.parser.parseError("adoption-agency-1.1", {"name": token["name"]})
13681368
return
13691369

13701370
# Step 1 paragraph 2
1371-
elif afeElement not in self.tree.openElements:
1371+
elif formattingElement not in self.tree.openElements:
13721372
self.parser.parseError("adoption-agency-1.2", {"name": token["name"]})
1373-
self.tree.activeFormattingElements.remove(afeElement)
1373+
self.tree.activeFormattingElements.remove(formattingElement)
13741374
return
13751375

13761376
# Step 1 paragraph 3
1377-
if afeElement != self.tree.openElements[-1]:
1377+
if formattingElement != self.tree.openElements[-1]:
13781378
self.parser.parseError("adoption-agency-1.3", {"name": token["name"]})
13791379

13801380
# Step 2
13811381
# Start of the adoption agency algorithm proper
1382-
afeIndex = self.tree.openElements.index(afeElement)
1382+
afeIndex = self.tree.openElements.index(formattingElement)
13831383
furthestBlock = None
13841384
for element in self.tree.openElements[afeIndex:]:
13851385
if (element.nameTuple in
@@ -1390,7 +1390,7 @@ def endTagFormatting(self, token):
13901390
# Step 3
13911391
if furthestBlock is None:
13921392
element = self.tree.openElements.pop()
1393-
while element != afeElement:
1393+
while element != formattingElement:
13941394
element = self.tree.openElements.pop()
13951395
self.tree.activeFormattingElements.remove(element)
13961396
return
@@ -1405,7 +1405,7 @@ def endTagFormatting(self, token):
14051405
# nodes in step 12. We have to ensure that we reinsert nodes after
14061406
# the node before the active formatting element. Note the bookmark
14071407
# can move in step 7.4
1408-
bookmark = self.tree.activeFormattingElements.index(afeElement)
1408+
bookmark = self.tree.activeFormattingElements.index(formattingElement)
14091409

14101410
# Step 6
14111411
lastNode = node = furthestBlock
@@ -1420,7 +1420,7 @@ def endTagFormatting(self, token):
14201420
self.tree.openElements.index(node)-1]
14211421
self.tree.openElements.remove(tmpNode)
14221422
# Step 6.3
1423-
if node == afeElement:
1423+
if node == formattingElement:
14241424
break
14251425
# Step 6.4
14261426
if lastNode == furthestBlock:
@@ -1437,7 +1437,7 @@ def endTagFormatting(self, token):
14371437
self.tree.openElements.index(node)] = clone
14381438
node = clone
14391439

1440-
# Step 7.6
1440+
# Step 6.6
14411441
# Remove lastNode from its parents, if any
14421442
if lastNode.parent:
14431443
lastNode.parent.removeChild(lastNode)
@@ -1455,7 +1455,7 @@ def endTagFormatting(self, token):
14551455
commonAncestor.appendChild(lastNode)
14561456

14571457
# Step 8
1458-
clone = afeElement.cloneNode()
1458+
clone = formattingElement.cloneNode()
14591459

14601460
# Step 9
14611461
furthestBlock.reparentChildren(clone)
@@ -1464,11 +1464,11 @@ def endTagFormatting(self, token):
14641464
furthestBlock.appendChild(clone)
14651465

14661466
# Step 11
1467-
self.tree.activeFormattingElements.remove(afeElement)
1467+
self.tree.activeFormattingElements.remove(formattingElement)
14681468
self.tree.activeFormattingElements.insert(bookmark, clone)
14691469

14701470
# Step 12
1471-
self.tree.openElements.remove(afeElement)
1471+
self.tree.openElements.remove(formattingElement)
14721472
self.tree.openElements.insert(
14731473
self.tree.openElements.index(furthestBlock) + 1, clone)
14741474

0 commit comments

Comments
 (0)