diff options
author | Leonard Richardson <leonardr@segfault.org> | 2020-09-26 11:18:12 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2020-09-26 11:18:12 -0400 |
commit | 4eef28adde8d1b09dda10b1f6c4f8f896a2b9393 (patch) | |
tree | d7f3b1e645f4fa3afd128a5d05fce939bc36de90 /bs4/element.py | |
parent | e37c55b111b6d3ece22237188ad77a1ea9cd3724 (diff) |
Fixed a bug that inconsistently moved elements over when passing
a Tag, rather than a list, into Tag.extend(). [bug=1885710]
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py index 130dfa9..370b153 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -457,6 +457,11 @@ class PageElement(object): :param tags: A list of PageElements. """ + if isinstance(tags, Tag): + # Calling self.append() on another tag's contents will change + # the list we're iterating over. Make a list that won't + # change. + tags = list(tags.contents) for tag in tags: self.append(tag) |