8000 Fixed bug in the PullDOM treewalker (found by reading the code, as th… · awesome-python/html5lib-python@f1b39f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1b39f7

Browse files
committed
Fixed bug in the PullDOM treewalker (found by reading the code, as there are no unit tests with void elements having children)
Removed the walk() method from _base.TreeWalker --HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40664
1 parent 0312190 commit f1b39f7

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/treewalkers/_base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ def __init__(self, tree):
1111
def __iter__(self):
1212
raise NotImplementedError
1313

14-
walk = __iter__
15-
1614
def error(self, msg):
1715
return {"type": "SerializeError", "data": msg}
1816

src/treewalkers/pulldom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from constants import voidElements
77

88
class TreeWalker(_base.TreeWalker):
9-
def walk(self):
9+
def __iter__(self):
1010
ignore_until = None
1111
previous = None
1212
for event in self.tree:
@@ -31,7 +31,7 @@ def tokens(self, event, next):
3131
name = node.nodeName
3232
if name in voidElements:
3333
for token in self.emptyTag(name, \
34-
node.attributes.items(), not event or event[1] is not node):
34+
node.attributes.items(), not next or next[1] is not node):
3535
yield token
3636
else:
3737
yield self.startTag(name, node.attributes.items())

0 commit comments

Comments
 (0)
0