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-typed-om] should the percent hint concept allow percentages to be numbers? #580

Closed
dbaron opened this issue Jan 28, 2018 · 1 comment

Comments

@dbaron
Copy link
Member

dbaron commented Jan 28, 2018

The section on numeric value typing defines a concept called a percent hint that seems to suggest what type a percent is compatible with. However, a bunch of the mechanisms here (such as the way the percent hint is stored, I think, and also the rules for adding types) don't seem compatible with the idea that a percent can be equivalent to a number, as it is for the CSS opacity.

I haven't entirely gotten through to see how percent hints end up being used (and some pieces still don't look fully fleshed out, e.g., the definition of type() on CSSNumericValue itself), but it seems like this might be problematic.

@tabatkins
Copy link
Member

We explicitly discussed 'opacity' in the context of normal CSS calc(), and agreed that numbers and %s can't be combined, as it makes unit algebra intractable. The lack of ability for the percent hint to be "number" is very intentional.

Percent hints just record what unit type a % ended up being resolved to, to make sure that you don't combine an expression that unified %s with lengths and an expression that unified %s with angles (even if the expression types end up being compatible at the point you're using them), because you can only resolve a % to a single type in a particular expression.

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