Allow for attributes without values #46

Closed
opened 9 years ago by basus · 5 comments
basus commented 9 years ago (Migrated from github.com)

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.

It seems like there are some HTML tags that accept attributes without values, for example, the [script async attribute](http://www.w3schools.com/tags/att_script_async.asp). 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.
mbutterick commented 9 years ago (Migrated from github.com)

What would you want the syntax to look like?

Are you aware of any other examples?

On Apr 14, 2015, at 2:39 PM, Shrutarshi Basu notifications@github.com wrote:

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.


Reply to this email directly or view it on GitHub.

What would you want the syntax to look like? Are you aware of any other examples? > On Apr 14, 2015, at 2:39 PM, Shrutarshi Basu notifications@github.com wrote: > > 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. > > — > Reply to this email directly or view it on GitHub.
mbutterick commented 9 years ago (Migrated from github.com)

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.

Also, are these two forms always equivalent? On the [async demo page](http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_script_async), 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](http://pkg-build.racket-lang.org/doc/txexpr/#%28part._.What_s_a_txexpr_%29).
basus commented 9 years ago (Migrated from github.com)

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 generates key="". Firefox seems to do the right thing, but not Chrome. Same for the second version you listed above.

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](http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#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 generates `key=""`. Firefox seems to do the right thing, but not Chrome. Same for the second version you listed above.
basus commented 9 years ago (Migrated from github.com)

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.

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.
mbutterick commented 9 years ago (Migrated from github.com)

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.

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.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen#46
Loading…
There is no content yet.