logoalt Hacker News

bikeshavingyesterday at 3:23 AM1 replyview on HN

I’m not sure this is correct. The DOM class HTMLDetailsElement has the `open` property, which you can use to read/write the details element’s state. If you’re using setAttribute/getAttribute just switch to the property.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetails...


Replies

crooked-vyesterday at 8:02 AM

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.

show 2 replies