[whatwg/dom] Could toggleAttribute set the attribute name? (#668)

I kinda expected a little pushback on using "empty string" in `toggleAttribute` due to JS assuming it's value is falsy. There is lots of places in M-C code that assumes `[attr=attr]` and also `[attr=true]`. Also there is a lot of code that checks `if (dom.hasAttribute("disabled")) {` etc.

https://html.spec.whatwg.org/#boolean-attributes makes it clear that `"true"` and `"false"` is invalid however would there be concerns in setting the boolean to be the attribute name instead?

I think there was concerns about `crossorigin` and others because they are boolean but also have attributes.

I think the assumptions about attribute presence can remain the same as it currently is, but instead it would set the attribute name when the current state is `!el.hasAttribute("attrname")`

/cc @johannhof @bzbarsky @annevk 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/668

Received on Friday, 20 July 2018 10:56:22 UTC