Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace underscores in HTML5 data attribute names with hyphens #478

Closed
codyrobbins opened this issue Jan 12, 2012 · 0 comments
Closed

Replace underscores in HTML5 data attribute names with hyphens #478

codyrobbins opened this issue Jan 12, 2012 · 0 comments
Milestone

Comments

@codyrobbins
Copy link

This is a feature request rather than a bug.

The example

%a{:href=>"/posts", :data => {:author_id => 123}} Posts By Author

given in the reference produces

<a data-author_id='123' href='/posts'>Posts By Author</a>

This markup is hideously ugly with the underscore—the data attribute should be named data-author-id. Since HAML isn’t substituting hyphens for the underscores automatically, there doesn’t really seem to be any advantage to using the special :data attribute key over just doing

%a{:href=>"/posts", 'data-author-id' => 123} Posts By Author

Using the :data key is more typing and you still end up having a string hash key for the attribute anyways:

%a{:href=>"/posts", :data => {'author-id' => 123}} Posts By Author

What’s the point?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants