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] Should parts of the CSS namespace be exposed on workers? #14229
However, per spec the CSS namespace is only exposed on Window (via [Exposed=Window] in here).
It seems Blink at least exposes CSS.number and co in workers.
When testing more aspects of the TypedOM API in workers, it seems no engine exports the CSS factory functions in workers. I think doing that would be ok since those interfaces are exposed in workers. Maybe CSS.escape and a couple others could work in there as well, they're useful for things like FontFace.
But my understanding is that it shouldn't work per spec right now. I have some ideas of how to fix this like:
Make the CSS namespace definition a plain [Exposed=(Window, Worker, ...)] namespace CSS {}
Make the existing CSS partials except the TypedOM one[Exposed=Window].
Is there a cleaner alternative @tabatkins? I worry a bit about future specs just doing partial namespace CSS and they not realizing by default it's exposing stuff to workers.
changed the title [-][css-typed-om] Parts of the CSS namespace should now be exposed on workers probably?[/-][+][css-typed-om] Should parts of the CSS namespace should now be exposed on workers?[/+]on Jul 27, 2026
changed the title [-][css-typed-om] Should parts of the CSS namespace should now be exposed on workers?[/-][+][css-typed-om] Should parts of the CSS namespace be exposed on workers?[/+]on Jul 27, 2026
It seems that you can manually construct a lot of these on a worker already via new CSSUnitValue, so this would mostly be exposing syntax sugar which is available on the main thread.
It seems that you can manually construct a lot of these on a worker already via new CSSUnitValue, so this would mostly be exposing syntax sugar which is available on the main thread.
Yes. sgtm to expose this in workers (and layout and paint worklets)
Interestingly, Chrome currently exposes a lot of these APIs in paint/layout worklets, but not workers. @javifernandez is working on fixing that.
@javifernandez could you supply the proposed async resolution?
Proposed resolution: "Make the CSS namespace definition a plain [Exposed=(Window, Worker, ...)] namespace CSS {}, pining specific partial namespaces to Window context, when needed."
The CSSWG will automatically accept this resolution one week from now if no objections are raised here. Anyone can add an emoji to this comment to express support. If you do not support this resolution, please add a new comment.
Proposed Resolution: Make the CSS namespace definition a plain [Exposed=(Window, Worker, ...)] namespace CSS {}, pinning specific partial namespaces to Window context, when needed.
RESOLVED: Make the CSS namespace definition a plain [Exposed=(Window, Worker, ...)] namespace CSS {}, pinning specific partial namespaces to Window context, when needed.
Activity
emilio commentedon Jul 27, 2026
It seems WebKit does not expose
CSS.number()and co. in workers. So maybe the alternative is saying the spec is right and fix Blink?cc @lilles @janvarga @cdumez, thoughts?
[-][css-typed-om] Parts of the CSS namespace should now be exposed on workers probably?[/-][+][css-typed-om] Should parts of the CSS namespace should now be exposed on workers?[/+]emilio commentedon Jul 27, 2026
Rewording because I misunderstood @janvarga when discussing this over Matrix :)
[-][css-typed-om] Should parts of the CSS namespace should now be exposed on workers?[/-][+][css-typed-om] Should parts of the CSS namespace be exposed on workers?[/+]emilio commentedon Jul 27, 2026
It seems that you can manually construct a lot of these on a worker already via
new CSSUnitValue, so this would mostly be exposing syntax sugar which is available on the main thread.janvarga commentedon Jul 27, 2026
Yes, this would help with converting more Typed OM WPT to any.js
javifernandez commentedon Jul 27, 2026
I'm working on the PR 61330 to updated some of these tests to any.js
lilles commentedon Jul 28, 2026
Yes. sgtm to expose this in workers (and layout and paint worklets)
Interestingly, Chrome currently exposes a lot of these APIs in paint/layout worklets, but not workers. @javifernandez is working on fixing that.
astearns commentedon Nov 2, 2026
@javifernandez could you supply the proposed async resolution?
javifernandez commentedon Nov 9, 2026
Proposed resolution: "Make the CSS namespace definition a plain [Exposed=(Window, Worker, ...)] namespace CSS {}, pining specific partial namespaces to Window context, when needed."
astearns commentedon Nov 16, 2026
The CSSWG will automatically accept this resolution one week from now if no objections are raised here. Anyone can add an emoji to this comment to express support. If you do not support this resolution, please add a new comment.
Proposed Resolution: Make the CSS namespace definition a plain
[Exposed=(Window, Worker, ...)] namespace CSS {}, pinning specific partial namespaces to Window context, when needed.astearns commentedon Nov 24, 2026
RESOLVED: Make the CSS namespace definition a plain
[Exposed=(Window, Worker, ...)] namespace CSS {}, pinning specific partial namespaces to Window context, when needed.