Closed Bug 1950717 Opened 6 months ago Closed 5 months ago

Element.animate() throws error but should return Animation object

Categories

(Core :: DOM: Animation, defect)

Firefox 135
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: seanmonahan, Unassigned)

Details

(Keywords: parity-chrome)

Attachments

(1 file)

Steps to reproduce:

  1. Load to example: https://codepen.io/seanms/pen/ZYEpoNP?editors=1111
  2. Open the console so you can see logging
  3. Click "append frame"
  4. Click "create element"
  5. Click "remove frame"
  6. Click "animate element"
  7. Observe the error message in the console

Actual results:

An error is thrown.

Expected results:

An Animation object should be returned.

Here's the relevant spec: https://drafts.csswg.org/web-animations-1/#dom-animatable-animate

And MDN: https://developer.mozilla.org/en-US/docs/Web/API/Element/animate#return_value

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

According to the spec, throwing an exception is right thing instead of null like Chrome...

Looks like that the method is created by Brian and maintained by Arai-san. Ccing them.

Component: DOM: Core & HTML → DOM: Animation
Keywords: parity-chrome

Yeah, Chrome is definitely wrong here. Animatable.animate should never return null.

It's still probably worth checking what step is triggering the exception and making sure the spec agrees that an exception should be thrown in that case. (I'm assuming it's to do with the fact that we need to create the KeyframeEffect in the relevant realm of globalElement but the corresponding iframe has been removed.)

The severity field is not set for this bug.
:boris, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(boris.chiou)
Flags: needinfo?(boris.chiou)

(In reply to Brian Birtles (:birtles) from comment #3)

Yeah, Chrome is definitely wrong here. Animatable.animate should never return null.

It's still probably worth checking what step is triggering the exception and making sure the spec agrees that an exception should be thrown in that case. (I'm assuming it's to do with the fact that we need to create the KeyframeEffect in the relevant realm of globalElement but the corresponding iframe has been removed.)

In Gecko, I just run the test and trace what we did. We trigger an exception and return null (implementation-dependent because there is an error):
https://searchfox.org/mozilla-central/rev/f07a6b1e84a609fbf9746f67be9edd43b3ed3362/dom/base/Element.cpp#4077

Yes, per spec it doesn't say animate() may return null. So I think this is more like a spec issue. (I am trying to file a spec issue for this, so close the bug for now)

Mark this invalid for now. Once we have more information from spec issue, we may reopen this.

Status: UNCONFIRMED → RESOLVED
Closed: 5 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: