summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2015-06-28 14:08:48 -0400
committerLeonard Richardson <leonardr@segfault.org>2015-06-28 14:08:48 -0400
commit92ad5e0dee9503f507f6277b493dfa96010f3a44 (patch)
tree53e6615b01afa7da78a325ce4b498f3c01e6a662 /bs4/element.py
parentec60474030e5ae091dc3500312f9447dcc7d56bf (diff)
Copying a NavigableString will give you a new NavigableString that is not connected to the parse tree.
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py
index d1b7c12..0486da2 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -689,7 +689,10 @@ class NavigableString(unicode, PageElement):
return u
def __copy__(self):
- return self
+ """A copy of a NavigableString has the same contents and class
+ as the original, but it is not connected to the parse tree.
+ """
+ return type(self)(self)
def __getnewargs__(self):
return (unicode(self),)