w3c/css-houdini-drafts

[css-typed-om] Simplifying math expressions

Closed this issue · 4 comments

CSS Values & Units defines a simplification process for calc() and other math functions, but CSS Typed OM defines no such process for reification. This means that per spec a specified value of e.g. calc(10px + 10px) is serialized as calc(20px) in CSSOM, but reified with the original structure in CSS Typed OM, and hence serialized as calc(10px + 10px).

According to this comment, there was an agreement, somewhere, at some point, that the simplification should not happen during serialization, but also "apply to underlying values". If so, this should be specified somewhere. Or we should explicitly require or disallow the simplification in CSS Typed OM.

@tabatkins As specified currently, math functions reify according to the original structure that was parsed, without any simplification. Is this intended?

cc @xiaochengh

Not intended, we just didn't have to worry as much about the underlying value/serialization distinction before. That simplification should move to the underlying value, yes. I'll re-file this over on CSS Values.

Lol, I filed it a year and a half ago. w3c/csswg-drafts#2245

Hehe, OK. Thanks for the clarification.