Re: [csswg-drafts] [css-env][css-scoping] Interaction between env variables and scoping (#2765)

> Should shadow tree inherit custom environment variables from host? Probably no?

Why not?

If not, would it mean that in order to use a document level custom env variable inside a shadow tree, I would need to define a new custom property inside the shadow tree and use the env variable value for it?  For example:

```html
<custom-element>
  # shadow-root
    <div class="inner-part"></div>
    <style>
      :host {
        --inner-part-prop: env(global-var);
      }

      .inner-part {
        property: var(--inner-part-prop);
      }
    </style>
</custom-element>
```

> Should we allow host to set custom environment variables of shadow tree? Maybe useful?

And this would then mean that I could replace `--inner-part-prop` with a new custom env variable which is scoped to that shadow tree, right?

In any case, I think it should somehow be possible to utilize document level custom env variables in shadow trees. I think theming is one candidate use case at least.

-- 
GitHub Notification of comment by jouni
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2765#issuecomment-447263010 using your GitHub account

Received on Friday, 14 December 2018 09:11:15 UTC