Skip to content

Commit

Permalink
Merge d9e7071 into 227e072
Browse files Browse the repository at this point in the history
  • Loading branch information
golightlyb committed Nov 16, 2019
2 parents 227e072 + d9e7071 commit 3db848d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions conftest.py
@@ -0,0 +1,2 @@
# used by pytest to test against the local copy of dominate
# (this file is important even though it is empty)
3 changes: 2 additions & 1 deletion dominate/dom_tag.py
Expand Up @@ -402,7 +402,8 @@ def clean_attribute(attribute):
attribute = attribute[1:]

# Workaround for dash
if attribute in set(['http_equiv']) or attribute.startswith('data_'):
special_prefix = any([attribute.startswith(x) for x in ('data_', 'aria_')])
if attribute in set(['http_equiv']) or special_prefix:
attribute = attribute.replace('_', '-').lower()

# Workaround for colon
Expand Down
6 changes: 6 additions & 0 deletions tests/test_html.py
Expand Up @@ -208,6 +208,12 @@ def test_attributes():
attr(id='moo')


def test_attribute_dashes():
# fix issue #118 (https://github.com/Knio/dominate/issues/118)
expected = '<div aria-foo="bar" data-a-b-c="foo" data-page-size="123"></div>'
assert div(data_a_b_c='foo', data_page_size='123', aria_foo='bar').render() == expected


def test_lazy():
from dominate import util
executed = [False]
Expand Down

0 comments on commit 3db848d

Please sign in to comment.