w3c / w3c/csswg-drafts

[css-env-1] How to handle `env()` in descriptors not exposed as `CSSOMString`?

Open
#11,264 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-env-1
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

env()-containing declaration values are valid at parse time (spec). If I am not mistaken, env() should be internally preserved even after substitution, and should show up in the serialization, in order to be processed whenever an environment value changes.

But env()-containing values are incompatible with font feature value descriptors and @view-transition/types, which are the only descriptors exposed as a specific value type via the CSSOM, rather than as a CSSOMString.

Now I am aware that the current browser support for env() is limited to property declarations and declarations in @page/margin rules, and that I am reporting a problem that will probably never happen because authors will never use env() for these descriptors. But it might happen for future descriptors.

If env() is here to stay for any descriptor of any rule, and should be preserved in the serialization, I think any descriptor should either be exposed as CSSOMString or not be exposed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CSS Environment Variables Module Level 1 section on env() and compare its serialization behavior with the CSSOM definitions for font feature value descriptors and @view-transition/types. Check whether the cited descriptor value types can preserve env() values; done means documenting or resolving the specification's consistent handling for current and future descriptors.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.