Re: [csswg-drafts] [css-shadow-parts] Make `::slotted()` a combinator (#7922)

To summarize the F2F discussion, @emilio was uncomfortable with the idea of a combinator that takes a limited syntax, and wanted us to have a plan for how we may be able to relax the limitations before we resolve to do it.

I edited the OP to add my counterarguments:

> The intended way of going from one element to another based on their relationship in the DOM is combinators. That's why combinators exist. Even introducing a combinator that is _just_ as restricted in syntax as the pseudo-element (minus the restrictions that are inherent to it being a pseudo-element) fixes many of these problems, and paves the way for relaxing the restrictions even further down the line.
> 
> Sure, it is a wart to have a combinator with a restricted syntax, but it's only **one** wart (and possibly even a temporary one) which allows us to solve numerous others.
> 
> Sure, all of these can be special-cased for `::slotted()`, but that adds cognitive overhead for authors and complicates implementations in a way that is (a) perpetual (special casing needs to persist forever) and (b) unbounded — these special cases will only keep increasing.
> 
> Yes, we can't get rid of `::slotted()` for the foreseeable future, even if we add this, but at least we can stop special casing stuff around it, and just direct authors to `/slotted/`. And who knows, maybe even down the line usage could drop below the axing threshold.

I also updated the OP to:
1. List other DOM APIs that take selectors (`querySelector()`, `querySelectorAll()`, `closest()`, `matches(), etc) — it's not just qSA, _all_ of these would need to be special cased.
2. Correct the statement about specificity (I have since learned it is unrelated and has to do with how shadow CSS is treated as a separate, lower priority origin.

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


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

Received on Friday, 21 February 2025 01:23:46 UTC