[csswg-drafts] [web-animations-1] should an animation be ready if it lacks a browsing context? (#8439)

graouts has just created a new issue for https://github.com/w3c/csswg-drafts:

== [web-animations-1] should an animation be ready if it lacks a browsing context? ==
There is a WPT test added in https://github.com/web-platform-tests/wpt/commit/90f237a0d0621f719a3afa36c94d8b77aa5c65be which [does the following](https://github.com/web-platform-tests/wpt/blob/0598a719081c98f88e6a044718dec2cb0f7c2682/web-animations/interfaces/Animatable/animate-no-browsing-context.html#L77):

```javascript
promise_test(t => {
  let anim;
  return getXHRDoc(t).then(xhrdoc => {
    const div = xhrdoc.getElementById('test');
    anim = div.animate(null);
    anim.timeline = document.timeline;
    assert_true(anim.pending, 'The animation should be initially pending');
    return waitForAnimationFrames(2);
  }).then(() => {
    // Because the element is in a document without a browsing context, it will
    // not be rendered and hence the user agent will never deem it ready to
    // animate.
    assert_true(anim.pending,
                'The animation should still be pending after replacing'
                + ' the document timeline');
  });
}, 'Replacing the timeline of an animation targetting an element in a'
   + ' document without a browsing context leaves it in the pending state');
```

At the time of wring, only Firefox passes that test because both Safari and Chrome resolve the `ready` promise for this element, likely because it is associated with a timeline that is associated with a document with a browsing context.

However, the Web Animations spec does not mention the notion of a _browsing context_ once. This comment in the test:

```
    // Because the element is in a document without a browsing context, it will
    // not be rendered and hence the user agent will never deem it ready to
    // animate.
```

… very likely refers to this spec text [about being _ready_](https://drafts.csswg.org/web-animations-1/#ready):

> An animation is ready at the first moment where both of the following conditions are true:
>
> the user agent has completed any setup required to begin the playback of the animation’s [associated effect](https://drafts.csswg.org/web-animations-1/#animation-associated-effect) including rendering the first frame of any [keyframe effect](https://drafts.csswg.org/web-animations-1/#keyframe-effect).

But I think this definition is too vague to infer that an animation targeting an element that is in a document without a browsing context should not be in the _ready_ state. For instance, is an element with `display: none` able to render its first frame?

I think we need to clarify what impact the availability of a browsing context has on an animation's _ready_ state.

Assigning this to @birtles as the author of this test, also cc'ing @flackr. 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8439 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 9 February 2023 17:14:14 UTC