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-values-4] <integer> grammar terms and <number>-returning functions #11040

Open
tabatkins opened this issue Oct 15, 2024 · 1 comment
Open
Labels

Comments

@tabatkins
Copy link
Member

Grammars can specify that they take either a <number>, or specifically an <integer>. This behavior is well-defined for literal tokens, but less clear for functions evaluating to these types.

Math functions that resolve to a <number> are defined to be allowed to satisfy an <integer> production; their value is rounded to the nearest integer. Similarly, interpolation between two <integer> terms is defined to round to the nearest integer. But there's not actually anything saying, one way or the other, how to treat other functions that return a <number> but aren't math functions, like sibling-index(). We have never defined a function as returning an <integer>; are these functions simply invalid to be used in z-index and the like?

I propose that we adopt the "round to the nearest integer" behavior for everything that's not a literal <number-token>. (The behavior for <number-token> is probably too entrenched to change.)

Agenda+ as this is a change to a stable spec.

@Loirooriol
Copy link
Contributor

Loirooriol commented Oct 16, 2024

Seems reasonable, but specifically for sibling-index(), I guess it could just be defined as returning an <integer> instead? Not having a precedent doesn't seem a big deal.

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

No branches or pull requests

2 participants