summaryrefslogtreecommitdiff
path: root/bs4/builder/_html5lib.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-15 12:01:33 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-15 12:01:33 -0500
commit177c00b50f6bdf2b5e82fdaf803c8cdf84897fad (patch)
tree966003bcd502b96c9f0e6643a7102c1d34832b4c /bs4/builder/_html5lib.py
parentca36c069183cd9754c0751f40337d0e5510d6b6d (diff)
downloadbeautifulsoup4-177c00b50f6bdf2b5e82fdaf803c8cdf84897fad.tar.gz
Removed _nodeIndex, because the misfeature it works around is now gone.
Diffstat (limited to 'bs4/builder/_html5lib.py')
-rw-r--r--bs4/builder/_html5lib.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/bs4/builder/_html5lib.py b/bs4/builder/_html5lib.py
index a9547cd..dccad83 100644
--- a/bs4/builder/_html5lib.py
+++ b/bs4/builder/_html5lib.py
@@ -125,13 +125,6 @@ class Element(html5lib.treebuilders._base.Node):
self.soup = soup
self.namespace = namespace
- def _nodeIndex(self, node, refNode):
- # Finds a node by identity rather than equality
- for index, element in enumerate(self.element.contents):
- if id(element) == id(refNode.element):
- return index
- return None
-
def appendChild(self, node):
if (node.element.__class__ == NavigableString and self.element.contents
and self.element.contents[-1].__class__ == NavigableString):
@@ -172,7 +165,7 @@ class Element(html5lib.treebuilders._base.Node):
self.appendChild(text)
def insertBefore(self, node, refNode):
- index = self._nodeIndex(node, refNode)
+ index = self.element.index(refNode.element)
if (node.element.__class__ == NavigableString and self.element.contents
and self.element.contents[index-1].__class__ == NavigableString):
# (See comments in appendChild)