summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2023-03-20 11:44:25 -0400
committerLeonard Richardson <leonardr@segfault.org>2023-03-20 11:44:25 -0400
commitd923a1cc966a4faa966f5d6f0a1fe09bd482949a (patch)
treed766d5b1cf42367d804af718265c941faa0b60c9
parent5b3e6a0a74631a8cd9ca21e6693c25e61203d96f (diff)
Make sure PageElement has the known_xml attribute. [bug=2007895]
-rw-r--r--bs4/element.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 619fb73..1dd5984 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -148,6 +148,11 @@ class PageElement(object):
NavigableString, Tag, etc. are all subclasses of PageElement.
"""
+ # In general, we can't tell just by looking at an element whether
+ # it's contained in an XML document or an HTML document. But for
+ # Tags (q.v.) we can store this information at parse time.
+ known_xml = None
+
def setup(self, parent=None, previous_element=None, next_element=None,
previous_sibling=None, next_sibling=None):
"""Sets up the initial relations between this element and
@@ -935,11 +940,6 @@ class NavigableString(str, PageElement):
PREFIX = ''
SUFFIX = ''
- # We can't tell just by looking at a string whether it's contained
- # in an XML document or an HTML document.
-
- known_xml = None
-
def __new__(cls, value):
"""Create a new NavigableString.