From d923a1cc966a4faa966f5d6f0a1fe09bd482949a Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Mon, 20 Mar 2023 11:44:25 -0400 Subject: Make sure PageElement has the known_xml attribute. [bug=2007895] --- bs4/element.py | 10 +++++----- 1 file 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. -- cgit v1.2.3