-
Notifications
You must be signed in to change notification settings - Fork 48
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
Handle boolean attributes better #80
Comments
Boolean attributes in HTML 5:
|
I like this idea, but is this compatible with earlier HTML versions? I'd like to keep the API similar for e.g. |
I'm not sure HTML4 even has any of these attributes, regardless of form? |
Scratch that, it has some of them and it supports the same forms: http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.3.4.2 |
It's a good idea. We should do this change. Thanks for suggesting this @dag. |
2015 bump I've recently started using blaze-html and this issue stands out. |
Just stumbled upon the same question. I take it no progress since 2015. :) |
no progress for 10 years, time to celebrate! |
🥳 I'd happily merge this change if someone has time to put this together. One requirement is that I don't want to break the existing API, so I would do this as an addition of new attributes. We currently have:
We could either use a
As a first step this could reuse the existing |
I can see why this hasn't been fixed though, as almost all of the recent CSS frameworks implement boolean markers via class attribute values, so that for instance the independent I've skimmed through the |
I found another option that doesn't change API at the cost of an extra pattern match for every rendered attribute. Let's say |
There's a benefit in having the lack of an argument in the type system. It reduces the chance you accidentally pass a value expecting it to have meaning. That's probably an argument for having a breaking change @jaspervdj was hesitant to do in #80 (comment). Effectively I'd say all uses of |
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#boolean-attribute
Currently attributes like
disabled
andchecked
(there are many more) in blaze-html all take an argument which means you have to give them the empty string or the name of that attribute (which you can misspell), and that the rendering will be cluttered with redundant noise.I think it would be better to export e.g.
disabled :: Attribute
and then render that as simplydisabled
(might require tracking it in theMarkupM
type?).The text was updated successfully, but these errors were encountered: