diff options
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py index 4a4d3ed..2e3be46 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -1170,6 +1170,12 @@ class SoupStrainer(object): kwargs['class'] = attrs attrs = None + if 'class_' in kwargs: + # Treat class_="foo" as a search for the 'class' + # attribute, overriding any non-dict value for attrs. + kwargs['class'] = kwargs['class_'] + del kwargs['class_'] + if kwargs: if attrs: attrs = attrs.copy() |