Re: [css-houdini-drafts] [css-typed-om] Simplifying expressions in CSSMathValue subclasses.

.add(), .sub(), and .negate() all have special cases.  (.sub() has it by virtue of calling into the .add() algo.)

.mul() *could* have a special-case here - check if `this` + every value is a CSSUnitValue with type=number, or at most one has a different type, then return a plain CSSUnitValue accordingly.

.div() could have a special case - if this+values are all `CSSUnitValue`, and all the values (not `this`) are number type, we can return a CSSUnitValue.

.invert() could special-case a number type.

I agree that .min() and .max() could have the exact same special-case as .add().

Happy to add these in if others think they're good ideas.

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

Received on Thursday, 2 November 2017 20:20:14 UTC