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
commit8d17a394988fb70edbf4cc981ca6799964ae5d52 (patch)
treeb5847efb35f43e160dd2b316fea48db5fd20f690 /bs4/builder/_html5lib.py
parent239ec495d5029edd834e8fd7b0d89c64ee52f9bc (diff)
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)