Skip to content

Conversation

@majido
Copy link
Contributor

@majido majido commented Jun 25, 2020

Add css syntax to for element-based offsets. Fixes #4337.

The element-based syntax is simply applied when the value starts with selector(#id) with the following characteristics:

  • <<id-selector>> is required and is expected to be the first value.
  • both edge and threshold are optional can can be provided in any order.

I followed some of the ideas mentioned by @tabatkins in #4348 to to get to a more ergonomic css function syntax. In particular there is no comma and the optional params can be in any order. Note that unlike #4348 we are not adding a function syntax.

@majido majido requested a review from tabatkins June 25, 2020 21:16
@majido
Copy link
Contributor Author

majido commented Jun 25, 2020

@tabatkins I appreciate if you could review. I particular I like to make sure the function design is correct and provides good ergonomics.

@majido
Copy link
Contributor Author

majido commented Jun 26, 2020

/cc @andruud to be aware of the upcoming css syntax.

@andruud
Copy link
Member

andruud commented Jun 26, 2020

Why not just:

<scroll-timeline-offset> = auto | <length-percentage> | <element-offset>
<element-offset> = selector(<id-selector>) [<element-offset-edge> || <number>]?
<element-offset-edge> = start | end

@majido
Copy link
Contributor Author

majido commented Jun 29, 2020

@andruud I like that idea. I went ahead and did it that way. Would you mind doing a review?

Removing Tab as reviewer since we no longer are using a function.

@majido majido requested review from andruud and removed request for tabatkins June 29, 2020 18:18
Copy link
Member

@andruud andruud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm


<pre>
<dfn>&lt;scroll-timeline-offset></dfn> = auto | <<length-percentage>> | <<element-offset>>
<dfn>&lt;element-offset></dfn> = selector(<<id-selector>>) [<<element-offset-edge>> || <<number>>]?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally my bad, since my suggestion had the same mistake, but we normally want function( <foo> ) rather than function(<foo>). See the math function syntax for reference.

The 'source' descriptor has the same issue, by the way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I fixed the syntax for selector.

@majido majido force-pushed the element-based-css branch from 44085cd to baaef61 Compare June 30, 2020 15:28
@majido majido merged commit 8b6eab7 into w3c:master Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Element-based start and end offsets

2 participants