Re: [csswg-drafts] [scroll-animations-1] Something is odd with the handling of `source` in the ScrollTimeline constructor (#5202)

> I guess the idea is that if the `ScrollTimelineOptions` may have a null source (which is the default value). And if that is given as input we resolve it to root scroller. So constructed timeline will never have a null source.

But the spec explicitly says that the Document can have no scrollingElement and hence source can be null?

> However thinking about this more, I wonder if we should allow a three state in our handling:
> 
> * Unspecified: Use document scroller e.g., `new ScrollTimeline({}); /*or*/ new ScrollTimeline()`
> * Explicitly set to null:  set source to to null  e.g., `new ScrollTimeline({source: null}) `
> * Explicitly set to element:  set source to element  e.g., `new ScrollTimeline({source: $div}) `

That would solve this issue (once we also define the behavior when source is null, e.g. in the "resolve a container-based offset" algorithm). I'm not sure if it's _useful_ to be able to do that, but maybe it's fine.

-- 
GitHub Notification of comment by birtles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5202#issuecomment-644480218 using your GitHub account

Received on Tuesday, 16 June 2020 01:44:24 UTC