Skip to content

Commit

Permalink
Merge pull request #248 from doobeh/master
Browse files Browse the repository at this point in the history
hyphenate all data-attribute underscores
  • Loading branch information
crast committed Feb 15, 2016
2 parents 6b6ac86 + 05b1128 commit c76a96c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/widgets.py
Expand Up @@ -32,7 +32,7 @@ def test_basic(self):

def test_data_prefix(self):
self.assertEqual(html_params(data_foo=22), 'data-foo="22"')
self.assertEqual(html_params(data_foo_bar=1), 'data-foo_bar="1"')
self.assertEqual(html_params(data_foo_bar=1), 'data-foo-bar="1"')

def test_quoting(self):
self.assertEqual(html_params(foo='hi&bye"quot'), 'foo="hi&bye"quot"')
Expand Down
2 changes: 1 addition & 1 deletion wtforms/widgets/core.py
Expand Up @@ -44,7 +44,7 @@ def html_params(**kwargs):
if k in ('class_', 'class__', 'for_'):
k = k[:-1]
elif k.startswith('data_'):
k = k.replace('_', '-', 1)
k = k.replace('_', '-')
if v is True:
params.append(k)
elif v is False:
Expand Down

0 comments on commit c76a96c

Please sign in to comment.