diff --git a/requests_html.py b/requests_html.py
index 6b4ae4d..c451be8 100644
--- a/requests_html.py
+++ b/requests_html.py
@@ -302,8 +302,9 @@ class Element(BaseParser):
attrs = {k: v for k, v in self.element.items()}
# Split class up, as there are ussually many of them:
- if 'class' in attrs:
- attrs['class'] = tuple(attrs['class'].split())
+ for attr in ['class']:
+ if attr in attrs:
+ attrs[attr] = tuple(attrs[attr].split())
return attrs
diff --git a/tests/test_requests_html.py b/tests/test_requests_html.py
index d0f34ee..1cfa72c 100644
--- a/tests/test_requests_html.py
+++ b/tests/test_requests_html.py
@@ -21,6 +21,14 @@ def test_file_get():
assert r.status_code == 200
+@pytest.mark.ok
+def test_class_seperation():
+ r = get()
+
+ about = r.html.find('#about', first=True)
+ assert len(about.attrs['class']) == 2
+
+
@pytest.mark.ok
def test_css_selector():
r = get()
@@ -151,4 +159,4 @@ def test_bare_js_eval():
if __name__ == '__main__':
- test_anchor_links()
+ test_class_seperation()