-
Notifications
You must be signed in to change notification settings - Fork 314
Closed
Description
https://dom.spec.whatwg.org/#concept-element-attributes-change first runs the change steps, then sets the value.
That means that if the steps trigger something that then changes the relevant attribute, per spec we should keep the "old" value, which seems wrong.
Example:
<!doctype html>
<div popover="manual">wat</div>
<button>Hide</button>
<script>
let div = document.querySelector("div");
div.addEventListener("beforetoggle", function(e) {
if (e.newState == "closed") {
this.setAttribute("popover", "manual");
}
})
document.querySelector("button").addEventListener("click", function(e) {
div.removeAttribute("popover");
});
div.showPopover();
</script>
Per spec, after clicking the value the popover
attribute should not be there, which is wrong and doesn't match implementations.
My guess is that modulo that case this is generally not very observable, because other attribute change steps are usually async.
It feels very weird tho that removeAttribute
runs script synchronously for popover btw...
cc @mbrodesser-igalia, @mfreed7, @domenic, @annevk, @smaug----
Metadata
Metadata
Assignees
Labels
No labels