[csswg-drafts] [css-typed-om-1] Should non-integer <number> values for tab-size round-trip as CSSUnitValue or CSSMathSum? (#13828)

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

== [css-typed-om-1] Should non-integer <number> values for tab-size round-trip as CSSUnitValue or CSSMathSum? ==
There appears to be an interop mismatch between engines when setting a **non-integer `<number>`** value for `tab-size` via Typed OM.

Consider:

```js
document.body.attributeStyleMap.set(
  'tab-size',
  new CSSUnitValue(3.14, 'number')
);

console.log(document.body.style.tabSize);
console.log(document.body.attributeStyleMap.get('tab-size'));
```

Current behavior differs across engines:

* **Chrome**

  * `style.tabSize` -> `"calc(3.14)"`
  * `attributeStyleMap.get('tab-size')` -> `CSSMathSum`

* **Safari**

  * `style.tabSize` -> `"calc(3.14)"`
  * `attributeStyleMap.get('tab-size')` -> `CSSMathSum`

* **Firefox** (in progress)

  * `style.tabSize` -> `"3.14"`
  * `attributeStyleMap.get('tab-size')` -> `CSSUnitValue`

This behavior appears to apply **only to non-integer numbers**.

For comparison, plain CSSOM string assignment:

```js
document.body.style.tabSize = "3.14";
console.log(document.body.style.tabSize);
```

serializes as:

```js
"3.14"
```

in all tested browsers.

It seems browsers should consistently preserve `<number>` values in this case, matching CSSOM behavior, rather than introducing `calc()` for non-integer values.


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


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

Received on Monday, 20 April 2026 08:16:57 UTC