summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py
index eb7e8aa..3ef6ef1 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -160,6 +160,11 @@ class PageElement(object):
replace_with_children = unwrap
replaceWithChildren = unwrap # BS3
+ def wrap(self, wrap_inside):
+ me = self.replace_with(wrap_inside)
+ wrap_inside.append(me)
+ return wrap_inside
+
def extract(self):
"""Destructively rips this element out of the tree."""
if self.parent is not None: