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

Right, using the value  `""` for boolean attributes to  mean "true" is the normal thing in HTML.  It used to be that they defaulted to their own name as the value in theory (but not  in practice), which is why  that's allowed by the spec.  But I'm not sure we should be adding new APIs that do that.

Another relevant data point: when doing  this:

     <input type="checkbox" id="thing">
     <script>
       document.getElementById("thing").defaultChecked  = true;
     </script>

you land in https://html.spec.whatwg.org/#reflect for the boolean case, which says:

> On setting, the content attribute must be removed if the IDL attribute is set to false, and must be set to the empty string if the IDL attribute is set to true.

and it seems to me like `toggleAttribute` should match the reflection behavior.

-- 
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#issuecomment-406636985

Received on Friday, 20 July 2018 15:33:16 UTC