Re: [csswg-drafts] [css-cascade-6] Should the scope proximity calculation be impacted by nesting scopes? (#10795)

So given something like

```
<div class="scope-2">
  <div><div><div>
    <div class="scope-1">
      <div class="styled"></div>
    </div>
  </div></div></div>
</div>
```

and given below rules:

```
@scope (.scope-2) {
  @scope(.scope-1) {
    .styled {
      background: blue;
    }
  }
}

/* Outer scope proximity, as per proposal, is infinity */
@scope (.scope-1) {
  .styled {
    background: green;
  }
}
```

The concern is that the applied `.styled` would depend purely on the order of declaration, right?

FWIW, authors that want this could coax this out by using `&` and relying on specificity, becoming very CSS Nesting-like:

```
@scope (.scope-2) {
  @scope(& .scope-1) {
    & .styled {
      background: blue;
    }
  }
}

@scope (.scope-1) {
  & .styled {
    background: green;
  }
}
```

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 9 October 2024 11:38:28 UTC