summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2012-08-16 13:28:14 -0400
committerLeonard Richardson <leonardr@segfault.org>2012-08-16 13:28:14 -0400
commit3bbb7de34487e43bb1373b44f45b32cd792cf914 (patch)
treea195ce9bf708b8b6aacba58890ca70485716b128 /bs4/element.py
parentf125bdd8f8370223329d1736c1f21224622e0b50 (diff)
As per PEP-8, allow searching by CSS class using the 'class_'
keyword argument. [bug=1037624]
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py6
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()