Re: [css-houdini-drafts] Add CSSMathValue Serialization body

Yeah, I think that's fine. If you actually wrote `calc(-1 + 2 + 3)`, it'll normalize to a `CSSMathSum(-1, 2, 3)` and then serialize back to `calc(-1 + 2 + 3)`, so the parens from an explicit `CSSMathNegate` seems fine.  (It's similar to `CSSMathSum(CSSMathSum(1, 2), 3)` serializing to `calc((1 + 2) + 3)`, which is intentional.)

However, if you write `calc(1 - 2 + 3)`, it'll normalize to `CSSMathSum(1, CSSMathNegate(2), 3)`, but it'll serialize back to `calc(1 - 2 + 3)`. Hm.  Possibly this means we should just make the normalization smarter, so that it'll normalize to `CSSMathSum(1, -2, 3)` instead of putting in a `CSSMathNegate` unnecessarily.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/489#issuecomment-361825246 using your GitHub account

Received on Wednesday, 31 January 2018 05:07:03 UTC