The wpt test Animation.timeline returns a timeline with no source for inactive deferred timeline in https://github.com/web-platform-tests/wpt/blob/master/scroll-animations/css/animation-timeline-deferred.html is testing that if you have the following:
<style>
.scope {
timeline-scope: --foo;
}
.animation {
animation-name: my-anim;
animation-timeline: --foo;
}
</style>
<div class=scope>
<div class=animating></div>
</div>
That if you get the animation you will get a timeline with a null source:
let animation = main.querySelector('.animating').getAnimations[0];
assert_equals(animation.timeline.source, null);
This seems reasonable, however I do not believe we have discussed or specified it, so opening this to take a resolution to specify this behavior and I think it is a bit tricky, so we should agree on it. In particular, there are a few details we should agree on.
- Per the test expectation,
animation.timeline returns a generic AnimationTimeline object.
- Since we cannot know what type the eventually attached animation timeline is (e.g. ViewTimeline or ScrollTimeline), it is a generic AnimationTimeline instance which means source is not a field on it.
- Since the type of the timeline depends on the eventual source, I expect that the timeline instance you get will not have the same identity as when a real source is attached. This raises the question of what should the identity match to? The simplest implementation-wise would be to have a single unresolved timeline instance that is used anytime we have an unresolved animation timeline, so I would propose this - all scoped timelines without an attached timeline return a shared unresolved timeline instance.
@kevers-google @andruud please add anyone else who may have context.
The wpt test
Animation.timeline returns a timeline with no source for inactive deferred timelinein https://github.com/web-platform-tests/wpt/blob/master/scroll-animations/css/animation-timeline-deferred.html is testing that if you have the following:That if you get the animation you will get a timeline with a null source:
This seems reasonable, however I do not believe we have discussed or specified it, so opening this to take a resolution to specify this behavior and I think it is a bit tricky, so we should agree on it. In particular, there are a few details we should agree on.
animation.timelinereturns a generic AnimationTimeline object.@kevers-google @andruud please add anyone else who may have context.