summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 315ee63..f75145c 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -27,19 +27,19 @@ class PageElement(object):
self.previousSibling = self.parent.contents[-1]
self.previousSibling.nextSibling = self
- def replaceWith(self, replaceWith):
+ def replace_with(self, replaceWith):
oldParent = self.parent
myIndex = self.parent.contents.index(self)
- if hasattr(replaceWith, 'parent') and replaceWith.parent == self.parent:
+ if hasattr(replace_with, 'parent') and replaceWith.parent == self.parent:
# We're replacing this element with one of its siblings.
- index = self.parent.contents.index(replaceWith)
+ index = self.parent.contents.index(replace_with)
if index and index < myIndex:
# Furthermore, it comes before this element. That
# means that when we extract it, the index of this
# element will change.
myIndex = myIndex - 1
self.extract()
- oldParent.insert(myIndex, replaceWith)
+ oldParent.insert(myIndex, replace_with)
def extract(self):
"""Destructively rips this element out of the tree."""