You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dev-platform
Many JavaScript libraries exist to toggle attributes in the DOM. By moving
this to the web platform we will simplify the boilerplate developers have
to use.
This method will behave similar to Element.classList.toggle, this will
allow developers to pass an argument of the attribute to toggle:
element.toggleAttribute(“disabled”);
It also permits an optional second argument for the state of the boolean to
set:
This feature isn’t restricted to Secure Contexts, this is mostly due to
providing similar behaviour with other element APIs such as hasAttribute
and setAttribute. There aren’t any increased risks in exposing this API to
insecure contexts and the behaviour can easily be implemented in a
JavaScript shim. It seems overly onerous on the web to mandate
SecureContext only for this when it could cause unexpected behaviour to
remove this API on an insecure connection.
In Firefox 63 I intend to turn Element.toggleAttribute on by default. Other
UAs are interested in implementing this feature as highlighted in the
standards thread: https://github.com/whatwg/dom/issues/461.