W3C home > Mailing lists > Public > public-css-archive@w3.org > May 2021

Re: [csswg-drafts] [css-scoping] Proposal for light-dom scoping/namespacing with re-designed `@scope` rule (#5809)

From: Oliver Joseph Ash via GitHub <sysbot+gh@w3.org>
Date: Wed, 12 May 2021 17:21:36 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-839955890-1620840095-sysbot+gh@w3.org>
Interesting, thanks for your response!

This is a contrived example but what if I want to use the scoped `meta` class alongside the global `title` class? E.g. in BEM:

```html
<article class="article">
  <!-- Here I'm deliberately *not* using the scoped styles -->
  <span class="title">Hello, World!</span>
  <span class="article__meta">foo</span>
</article>
```

I guess you could do something like this:

```css
@scope ( html ) to ( .exclusive ) {
  .title { color: blue; }
}

@scope (article) {
  .meta { font-style: italic; }
}

@scope (article.withTitle) {
  .title { font-size: 2em; }
}
```

```html
<article>
  <span class="title">Hello, World!</span>
  <span class="meta">foo</span>
</article>
```

```html
<article class="withTitle exclusive">
  <span class="title">Hello, World!</span>
  <span class="meta">foo</span>
</article>
```

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 12 May 2021 17:21:38 UTC

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