4 ms·
Having to use the property on the element instance, rather than the actual HTML attribute, is exactly the kind of wrapper code I want to avoid if I'm using a bu
by crooked-v 10mo ago
Having to use the property on the element instance, rather than the actual HTML attribute, is exactly the kind of wrapper code I want to avoid if I'm using a built-in.
- _heimdall 10mo agoWhat kind of control are you looking for? `open` works just like checked for a checkbox input. You can set the initial state in HTML and CSS can respond to changes in the attribute if a user clicks it. Markup won't have programmatic control over the attribute by design, that's always done in JS by modifying the element instance.
- WickyNilliams 10mo agoYou need some JS to change an attribute as much as you need JS to change a property. What am I missing? I hope the command attribute (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#command https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...) will eventually support this out of the box. In the meanwhile you can write a single custom --toggle command which is generic and works with any toggleable element