-
Notifications
You must be signed in to change notification settings - Fork 146
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
Toggle the presence of a class based on a boolean flag #44
Comments
Multiple classes would just repeat that structure? html! {
div.foo(foo).bar(bar) (content)
} Where |
Yeah I was thinking that as well. My issue isn't with the syntax, it's with the implementation. To be specific, if you look at the HTML output, whether or not "bar" has a space before it would depend on the presence of "foo". I guess that's enough of an edge case that we can ignore it -- having extra spaces in a class attribute is still valid after all. But it still feels kind of weird. |
Whoops -- turns out this syntax is ambiguous. Given the tokens I'm open to other suggestions for the syntax. |
The obvious alternatives would be
I don't like either much... Some random ideas:
The last one works as it's |
@TheNeikos Thanks for writing those out! I'm actually growing fond of the first alternative, using I've pushed the corresponding change to empty attributes as 68feeef, and I'd love to see how that turns out. |
It can often be useful to toggle a class based on a boolean flag. Need to be careful with multiple classes.
The text was updated successfully, but these errors were encountered: