- From: Boris Chiou via GitHub <sysbot+gh@w3.org>
- Date: Mon, 17 Mar 2025 22:03:03 +0000
- To: public-css-archive@w3.org
BorisChiou has just created a new issue for https://github.com/w3c/csswg-drafts:
== [web-animations-1] The expected behavior when calling animate() on the removed element ==
This is from a Gecko bug: [Bug 1950717](https://bugzilla.mozilla.org/show_bug.cgi?id=1950717).
Per [spec](https://drafts.csswg.org/web-animations-1/#the-animatable-interface-mixin), when calling animate(), we should return an Animation object.
However, what is the expected behavior if there are any errors? Here is a simple test case:
```
<script>
function run() {
let iframe = document.createElement('iframe');
container.appendChild(iframe);
let target = iframe.contentDocument.createElement('div');
window.setTimeout(() => {
iframe.remove();
let anims = target.animate(
[ { opacity: 0 }, { opacity: 1 } ],
1000);
console.log(anims);
}, 100);
}
</script>
<body onload="run()">
<div id="container"></div>
</body>
```
The target is removed, so it's impossible to create an Animation. In Blink, it just returns `null`. In Gecko, it throws a bowser-defined error, `NS_ERROR_FAILURE`. In WebKit, it returns an Animation.
I think it'd be nice to define the behavior when any errors happen.
cc @birtles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11950 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 17 March 2025 22:03:04 UTC