Re: [csswg-drafts] [css-nesting] :selector-replace() pseudo-class function (#6330)

I don't like being able to arbitrarily replace parts of parent selectors to something completely different. At that point I think you should just move that part outside of the nesting.

But being able to reference the elements matched by some ancestor rule (not just the parent) may be reasonable.

Using a property (or descriptor, I guess?) seems strange, though. I would add some syntax just after the selector, like

```css
.foo => &(foo) {
  & .bar {
    & .baz {
      @nest &(foo):focus & {}
    }
  }
}
```

Note that `&foo` means `&:is(foo)`, so we need a different syntax like `&(foo)`, or change the spec:

> The nesting selector is allowed anywhere in a compound selector, even before a type selector, violating the normal restrictions on ordering within a compound selector.

Also, I think you would still need to use a plain `&` in order to tell where the parent selector is.

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


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

Received on Tuesday, 1 June 2021 15:27:49 UTC