Skip to content

Commit

Permalink
Document use of 'none' as a range name in stead of null
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesodland committed Feb 27, 2024
1 parent 7afa913 commit 96c567c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/proxy-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,12 @@ function getNormalStartRange(timeline) {
}

if (timeline instanceof ScrollTimeline) {
// A CSSNumericValue should be interpreted as a TimelineRangeOffset with a null range name according to the spec,
// but we align with Blink which currently uses 'none' as a rangeName.

// There is an open issue to introduce 'scroll' as a range name for the entire scroll range.
// This would allow us to use 'scroll' instead of 'none'.
// https://github.com/w3c/csswg-drafts/issues/9367#issuecomment-1905812872
return { rangeName: 'none', offset: CSS.percent(0) };
}

Expand All @@ -952,6 +958,12 @@ function getNormalEndRange(timeline) {
}

if (timeline instanceof ScrollTimeline) {
// A CSSNumericValue should be interpreted as a TimelineRangeOffset with a null range name according to the spec,
// but we align with Blink which currently uses 'none' as a rangeName.

// There is an open issue to introduce 'scroll' as a range name for the entire scroll range.
// This would allow us to use 'scroll' instead of 'none'.
// https://github.com/w3c/csswg-drafts/issues/9367#issuecomment-1905812872
return { rangeName: 'none', offset: CSS.percent(100) };
}

Expand Down Expand Up @@ -1002,6 +1014,13 @@ function consumeRange(parts, position) {
// Format: <length-percentage>
const offset = CSSNumericValue.parse(part);
validateLengthPercentage(offset);

// A CSSNumericValue should be interpreted as a TimelineRangeOffset with a null range name according to the spec,
// but we align with Blink which currently uses 'none' as a rangeName.

// There is an open issue to introduce 'scroll' as a range name for the entire scroll range.
// This would allow us to use 'scroll' instead of 'none'.
// https://github.com/w3c/csswg-drafts/issues/9367#issuecomment-1905812872
return {rangeName: 'none', offset};
}
}
Expand Down

0 comments on commit 96c567c

Please sign in to comment.