Re: [csswg-drafts] [css-scoping] Consider aligning ::slotted() for fallback content with implementations (#5482)

I'll note that having `::slotted()` target fallback contents was not an explicit goal when I was writing the spec text; I just wrote the simplest thing that did the job using the tree constructs I had available. I don't think I have an opinion on which way we go with this; the argument that you'll probably want to style fallback differently from slotted content sounds reasonable to me, tho (and thus having `::slotted()` *not* match would be better).

Looking into the details a bit more, it looks like the spec might actually be wrong, and not match any implementations anyway! In particular, I'm using ["find slottables"](https://dom.spec.whatwg.org/#find-slotables) to produce the flattened tree (which is correct), and that means the inner shadow root in Rune's original example will have a `<slot>` (from the outer shadow root) as its direct child in the flat tree; the `span.a` element will be a grandchild instead, and is not "assigned, after flattening, to the slot that is ::slotted’s originating element" (instead it's just carried along by its parent, the outer shadow's `<slot>` that *is* "assigned, after flattening"), and thus won't be selected by `::slotted(.a)` in the inner shadow.

That's probably related to:

> This surfaced in a bug report from Salesforce which found inconsistencies between implementations, but it turns out that is about ::slotted(slot) matching nested slots in WebKit, while Blink and Firefox do not match those:

Because nested slots *should*, per spec, be matched by `::slotted(slot)`.  But apparently WebKit *also* colors Rune's first example orange, indicating they're *also* matching the `.a` grandchild of the inner slot???

Basically I'm very confused about what browsers are doing and am open to clarifying the spec any which way.

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


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

Received on Wednesday, 16 September 2020 17:29:34 UTC