diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-04-26 10:08:45 -0400 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-04-26 10:08:45 -0400 |
commit | e82a52cacd936b66d9f6290136278af00ea1428c (patch) | |
tree | bf118c8d2bbc701c8143eb8c584cfa2c8c3d4116 /bs4/builder/_html5lib.py | |
parent | 3ff7bde5d320fbec4c16e7f245c345e8455ca887 (diff) |
The test suite now passes when lxml is not installed, whether or not html5lib is installed. [bug=987004]
Diffstat (limited to 'bs4/builder/_html5lib.py')
-rw-r--r-- | bs4/builder/_html5lib.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/bs4/builder/_html5lib.py b/bs4/builder/_html5lib.py index 2d6fe31..6001e38 100644 --- a/bs4/builder/_html5lib.py +++ b/bs4/builder/_html5lib.py @@ -139,11 +139,20 @@ class Element(html5lib.treebuilders._base.Node): return AttrList(self.element) def setAttributes(self, attributes): - if attributes is not None and attributes != {}: + if attributes is not None and len(attributes) > 0: + + converted_attributes = [] for name, value in list(attributes.items()): if isinstance(name, tuple): - name = NamespacedAttribute(*name) - self.element[name] = value + new_name = NamespacedAttribute(*name) + del attributes[name] + attributes[new_name] = value + + self.soup.builder._replace_cdata_list_attribute_values( + self.name, attributes) + for name, value in attributes.items(): + self.element[name] = value + # The attributes may contain variables that need substitution. # Call set_up_substitutions manually. # |