summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2019-01-06 18:49:34 -0500
committerLeonard Richardson <leonardr@segfault.org>2019-01-06 18:49:34 -0500
commit37475317c329d38b6dfa6061695035fcbce6b7d4 (patch)
treefeb4bb09875fb9823d35272775b5a5601adcd3c9 /bs4/element.py
parent047ccd22fe038813024d5d29b9d68dc5616edac8 (diff)
Fixed an incorrectly raised exception when inserting a tag before or
after an identical tag. [bug=1810692]
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bs4/element.py b/bs4/element.py
index c367dee..5718d31 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -455,7 +455,7 @@ class PageElement(object):
if parent is None:
raise ValueError(
"Element has no parent, so 'before' has no meaning.")
- if self in args:
+ if any(x is self for x in args):
raise ValueError("Can't insert an element before itself.")
for predecessor in args:
# Extract first so that the index won't be screwed up if they
@@ -476,7 +476,7 @@ class PageElement(object):
if parent is None:
raise ValueError(
"Element has no parent, so 'after' has no meaning.")
- if self in args:
+ if any(x is self for x in args):
raise ValueError("Can't insert an element after itself.")
offset = 0