summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-28 12:25:51 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-28 12:25:51 -0500
commit5c7ff8e02ac0a2fe2966b04cb6862940face28c0 (patch)
tree3b832c107233b60e57c8199a8141d6fe7738073d /bs4/element.py
parent270cc37956de4ed1c4025b0d56aaf34a75d080d5 (diff)
Renamed replaceWith to replace_with.
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."""