[go: nahoru, domu]

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] note counter-intuitive interpretation of unitless 0 inside calc() #1114

Closed
mgiuffrida opened this issue Mar 17, 2017 · 1 comment

Comments

@mgiuffrida
Copy link

Section 8.1.2 **calc() Type Checking does not explicitly indicate how a unitless 0 inside a calc() expression is treated. For example:

left: calc(0 - 5px);

It's not clear whether this expression is invalid. Inside calc((), the types of arguments to the - operator must be compatible, and the rhs is of type dimension<length>. But what is the type of the lhs: number or dimension<length>?

Since section 5 says:

for zero lengths the unit identifier is optional (i.e. can be syntactically represented as the <number> '0'

I would argue that interpreting 0 as being of type dimension<length> would be valid, and would be more in line with developer expectations. However, this was discussed in 2010 with @tabatkins agreeing the 0 should cause a parse error. That's fine, but it would be helpful if the fact that 0 is never treated as a dimension inside calc() were explicitly noted in the spec (which was also agreed upon in that discussion).

@tabatkins
Copy link
Member

It's invalid. Note the spec text:

<number-token>s are of type <number> or <integer>.

I've gone ahead and added a note about this in 1024dc3.

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

3 participants