W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2018

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

From: Jouni Koivuviita via GitHub <sysbot+gh@w3.org>
Date: Fri, 14 Dec 2018 09:11:14 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-447263010-1544778672-sysbot+gh@w3.org>
> 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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:41 UTC