[fxtf-drafts] [geometry] DOMMatrix stringifier could now serialize NaN and infinity instead of throwing exceptions (#611)

AtkinsSJ has just created a new issue for https://github.com/w3c/fxtf-drafts:

== [geometry] DOMMatrix stringifier could now serialize NaN and infinity instead of throwing exceptions ==
The stringification behaviour for `DOMMatrix` [starts with](https://drafts.fxtf.org/geometry/#dommatrixreadonly-stringification-behavior):

> 1. If one or more of [m11 element](https://drafts.fxtf.org/geometry/#matrix-m11-element) through [m44 element](https://drafts.fxtf.org/geometry/#matrix-m44-element) are a non-finite value, then throw an "[InvalidStateError](https://webidl.spec.whatwg.org/#invalidstateerror)" [DOMException](https://webidl.spec.whatwg.org/#idl-DOMException).
> Note:​ The CSS syntax cannot represent NaN or Infinity values.

These values now *can* be represented, as `calc(NaN)` or `calc(infinity)`. [(spec)](https://drafts.csswg.org/css-values-4/#calc-error-constants)

The fact that this currently throws an exception means that other stringifiers that include a `DOMMatrix` also have to do so. Specifically I came across this for [serializing `CSSMatrixComponent`](https://drafts.css-houdini.org/css-typed-om-1/#serialize-a-cssmatrixcomponent), with the result that `CSSTransformComponent`, and also `CSSStyleValue`'s stringifiers all can throw exceptions, when otherwise they would not do so. So from an implementer point of view it'd be nice if they all just always succeeded instead.

I think serializing these values instead of throwing is also nicer for authors.

Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/611 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 16 September 2025 13:51:00 UTC