Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-easings-2] Accept <number> | <percentage> in linear() #9287

Closed
cdoublev opened this issue Sep 1, 2023 · 1 comment
Closed

[css-easings-2] Accept <number> | <percentage> in linear() #9287

cdoublev opened this issue Sep 1, 2023 · 1 comment

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Sep 1, 2023

https://drafts.csswg.org/css-easing-2/#linear-easing-function-syntax

linear() = linear( [ <number> && <percentage>{0,2} ]# )

(edit: the syntax has been simplified in 9573034)

What is the reason (if any) to not allow <percentage> as the output progress value? And vice-versa, to not allow <number>s as the input progress value? Ie. linear( [ [<number> | <percentage>]{1,3} ]# ).


aside

I think the target <number> range to resolve <percentage> should be explicitly defined, like with the Percent reference range of color functions in CSS Color 4.

@tabatkins
Copy link
Member

In theory this could be done. Two meaningful downsides, tho:

  1. We'd have to fix the argument order - output, then input. Gradients already fix their grammar in that order (tho for no particularly good reason), so it would match, but we try to avoid fixing grammar order if we can avoid it.
  2. (probably more important) It becomes genuinely harder to distinguish the values if they can both be the same type, or either type. If you read linear(0 10%, 20% 1), it would be very reasonable to presume that the %s match up and the numbers match up, equivalent to linear(0 10%, 1 20%), but under your proposal they'd actually match up purely positionally, so it's equivalent to linear(0 10%, .2 100%) instead. Forcing the two values to use different types aids readability here, and the particular usage of numbers vs percentages draws useful parallels with other syntaxes like gradients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants