summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2015-06-25 21:02:02 -0400
committerLeonard Richardson <leonardr@segfault.org>2015-06-25 21:02:02 -0400
commit89a4bcc0e1053ff75cd22e6dba8edc8eff387385 (patch)
treeb8885c630935bfad3a368b1914b410c10e5f7d98
parent0b9b0976b5219233bee143c09a3f35fc2a44d20e (diff)
Make it possible to invoke the Tag() constructor without providing a builder. [bug=1307471]
-rw-r--r--bs4/element.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 7fdeb08..95b6735 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -782,9 +782,12 @@ class Tag(PageElement):
self.prefix = prefix
if attrs is None:
attrs = {}
- elif attrs and builder.cdata_list_attributes:
- attrs = builder._replace_cdata_list_attribute_values(
- self.name, attrs)
+ elif attrs:
+ if builder is not None and builder.cdata_list_attributes:
+ attrs = builder._replace_cdata_list_attribute_values(
+ self.name, attrs)
+ else:
+ attrs = dict(attrs)
else:
attrs = dict(attrs)
self.attrs = attrs