summaryrefslogtreecommitdiff
path: root/bs4/__init__.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2021-02-13 13:54:56 -0500
committerLeonard Richardson <leonardr@segfault.org>2021-02-13 13:54:56 -0500
commit185ec704743ffa0dfd95b7a29e2f5d38a25433b5 (patch)
tree39c3535011cc9a1f1e32827d557eb40fba9fa183 /bs4/__init__.py
parent8f763297abc8bb598c3aca25eccaef6db7f7c987 (diff)
Corrected the use of special string container classes in cases when a
single tag may contain strings with different containers; such as the <template> tag, which may contain both TemplateString objects and Comment objects. [bug=1913406]
Diffstat (limited to 'bs4/__init__.py')
-rw-r--r--bs4/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bs4/__init__.py b/bs4/__init__.py
index 3714d67..7c6044a 100644
--- a/bs4/__init__.py
+++ b/bs4/__init__.py
@@ -497,7 +497,7 @@ class BeautifulSoup(Tag):
# On top of that, we may be inside a tag that needs a special
# container class.
- if self.string_container_stack:
+ if self.string_container_stack and container is NavigableString:
container = self.builder.string_containers.get(
self.string_container_stack[-1].name, container
)