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] FYI review of Allow infinity, -infinity and NaN in CSS calc() #708
Comments
Hi @DevSDK, We briefly looked at this today during a breakout and had a question. We were a little troubled by:
What is the reasoning to make NaN behave as +Infinity? |
Hi @LeaVerou , I guess my explainer need more description. According to the specification, Only output NaN value from calc() will be +Inf. (Inside of calc(), NaN acts NaN). I will edit my explainer to make this clear. cc. @xiaochengh |
@tabatkins spec editor in case I missed anything The situation here is that:
So treating calc() result NaN as positive infinity looks like an arbitrarily chosen fallback to me. Or would it better if we want to follow the same approach as custom properties that, any propety value involving a NaN |
@LeaVerou We've talked about this in CSS calls already (or in the issue tracker, I don't remember). Yes, treating it as infinity is just an arbitrary fallback that's likely to produce something obviously wrong, so the author will hopefully realize it. It's similar to invalid colors turning into transparent black. I didn't go for IACVT because that's a big stick and only necessary if we have no idea what the value's type is. For a math function, like a color function, that's not the case, so we can emit a slightly more relevant error value. initial/inherit can mask the error more easily. |
@LeaVerou, @atanassov and myself reviewed this issue during our Hybrid TAG f2f. We still have concerns about the current proposal that are best for the CSS WG to review, thus, we suggest another round of discussions there. In particular, we are concerned that imposing runtime errors through +infinity will break layouts in unpredictable ways. For the purposes of layout, calc expressions can be evaluated during used-value time which in turn can depend on user context. This can result in unpredictable and difficult to evaluate/debug problems. |
Are one of y'all (Lea?) gonna open a follow-up issue, or am I supposed to? |
Ah, I suppose the existing issue is still open and appropriate to use, disregard last message. |
Closing, since the latest WG resolution satisfies our concerns. Thank you for flying TAG! |
Braw mornin' TAG!
I'm requesting a TAG review of Allow infinity, -infinity and NaN in CSS calc().
Per the Chromium Intent to Ship, it was requested that I file a TAG review as a FYI - hence this request.
Further details:
You should also know that...
[please tell us anything you think is relevant to this review]
We'd prefer the TAG provide feedback as (please delete all but the desired option):
💬 leave review feedback as a comment in this issue and @-notify @DevSDK
The text was updated successfully, but these errors were encountered: