You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-typed-om] structuredClone for typed-om objects #1101
"structuredClone can’t deal with CSSUnitValue objects" issue is filed on crbug [1].
Currently, the css-typed-om spec[2] does not mark the [Serializable] attribute for typed-om objects.
Consequently, these objects are not contained in the platform objects that can be serializable according to the HTML spec [3].
So the browsers comply with that spec that throws an exception.
However, the following codes look very natural:
Given this, browsers appropriately throw an exception to comply with the spec.
However, consider the following code:
structuredClone(CSS.px(2))
This looks quite intuitive and straightforward.
If there is no extra context that I missed, could we consider supporting it?
It does seem straightforward to make them Serializable. Do we do this commonly? I'm just not sure what the web platform's usual mode of operation is for marking things as cloneable.
Activity
DevSDK commentedon Sep 14, 2025
@tabatkins Hi Tab, gentle ping for this issue and PR :). If there are particular no problem, I'll opened the CL for that!
tabatkins commentedon Sep 15, 2025
Whoa, sorry for missing this!
It does seem straightforward to make them Serializable. Do we do this commonly? I'm just not sure what the web platform's usual mode of operation is for marking things as cloneable.
DevSDK commentedon Sep 15, 2025
Yeah, it is straightforward!
AFAIK, the Serializable objects are marked as [Serializable] in idl due to structuredClone spec in whatwg:
https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects
and in the StructuredSerializeInternal ( value, forStorage [ , memory ] ), part of internal operation for structuredClone
So I think clonable by structuredClone equals to Serializable...?
E.g.,
For DOMMatrix (that supports structuredClone):
DevSDK commentedon Sep 21, 2025
One unclear thing was CSSImageValue, as per spec:
it seems probably not Serializable... yet...
DevSDK commentedon Sep 28, 2025
@tabatkins Hi tab, just FYI related draft CL ;)
https://chromium-review.googlesource.com/c/chromium/src/+/6952254
DevSDK commentedon Sep 30, 2025
cc. @bramus :)