Allow for attributes without values
#46
Closed
opened 10 years ago by basus
·
5 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
It seems like there are some HTML tags that accept attributes without values, for example, the script async attribute. It would be great to able to represent these in the attribute list as well, especially since things like embedding tweets make use of them.
What would you want the syntax to look like?
Are you aware of any other examples?
Also, are these two forms always equivalent? On the async demo page, they are.
<script src="demo_async.js" async>
<script src="demo_async.js" async="async">
The problem I foresee is that the first form (without a value) violates the grammar of X-expressions.
We could keep the syntax similar to that for key-value attributes, so it would be either
'key:value
or'key
. Apparently according to the HTML 5.1 spec boolean attributes are a thing, however, it seems like not all browsers support them correctly. I can fake them with the current pollen by writing'key:""
, which generateskey=""
. Firefox seems to do the right thing, but not Chrome. Same for the second version you listed above.Actually, looks like issue with Chrome is due to a Chrome extension that blocks social media tracking. With that disabled, the two forms both work fine.
Well, if you find evidence to the contrary, you can post it here & reopen the issue. Otherwise the best “fix” is just to use the alternative syntax, because that complies with X-expression grammar.