diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-15 14:27:21 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-15 14:27:21 -0500 |
commit | a06152365c336f41bdb5fb9513b9316740c1564a (patch) | |
tree | 72f7f6993624453d8f4a8ccc21ef88ef93cee59a /bs4/element.py | |
parent | be0c08585f54ec709740ff4352006bf3e605b8f2 (diff) |
Some cdata-list attributes are only cdata lists for certain tags.
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py index 5e15252..c6a7823 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -1,4 +1,5 @@ import collections +import itertools import re import sys import warnings @@ -524,7 +525,10 @@ class Tag(PageElement): else: attrs = dict(attrs) if builder.cdata_list_attributes: - for cdata_list_attr in builder.cdata_list_attributes: + universal = builder.cdata_list_attributes.get('*', []) + tag_specific = builder.cdata_list_attributes.get( + self.name.lower(), []) + for cdata_list_attr in itertools.chain(universal, tag_specific): if cdata_list_attr in attrs: # Basically, we have a "class" attribute whose # value is a whitespace-separated list of CSS |