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

Duplicate class attributes should probably get merged. #220

Open
bitemyapp opened this issue May 7, 2018 · 3 comments
Open

Duplicate class attributes should probably get merged. #220

bitemyapp opened this issue May 7, 2018 · 3 comments

Comments

@bitemyapp
Copy link
Contributor

In the spirit of "test first" methodology I made a breaking test first,

expected: "<foo class=\"first second third\">content</foo>\n"
        but got: "<foo class=\"first\" class=\"second\" class=\"third\">content</foo>\n"

When I was inspecting results in a browser from a client's application it looked more like <foo class="first">

Any hoodle, since class is a cdata-list it seems to me like the justification for space separated concatenation is there. I'd like to be able to programmatically inject additional classes into my markup using the *{...} syntax.

@bitemyapp
Copy link
Contributor Author

This behavior would have some justification from past design intent:

https://www.yesodweb.com/blog/2011/03/hamlet-lucius-widgets

If you have a class=someclass and a .otherclass, Hamlet will automatically combine them into class="someclass otherclass".

snoyberg added a commit that referenced this issue May 8, 2018
@snoyberg
Copy link
Member

snoyberg commented May 8, 2018

After some review: it looks like this will require too much refactoring to make it work as described. This is a good change, and if someone wants to take a stab at it, I got some initial work on this in bcc1cbf.

@bitemyapp
Copy link
Contributor Author

For posterity's sake in case anyone else needs quick fix, I injected the additional classes as space-separated text values in Hamlet using the normal #{...} syntax rather than using [(Text, Text)] and *{attrsVarName}.

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