Re: [WICG/webcomponents] There is no way to navigate to a fragment inside a shadow tree (#924)

> 
> 
> > That's is what I'm trying to say which means there is a bug because that piece is missing.
> > If you search for the documentation on the CSS pseudo-class, there is nothing that says "It doesn't work in Web Components by the way"
> 
> I don't think this is a bug per se. It's more of a missing feature. This is very much the intended behavior. In general, id references work within each [tree](https://dom.spec.whatwg.org/#concept-tree), not across shadow boundaries. For example, `document.getElementsById(id)` will only find elements with the specified id in the [document tree](https://dom.spec.whatwg.org/#concept-document-tree), not any of the [shadow trees](https://dom.spec.whatwg.org/#concept-shadow-tree) connected to it.

I will present it in a different way... 

There no need to cross boundaries. 
You use the example `document.getElementById(id)`, did you? Then, how about `this.shadowRoot.getElementById(id)`?
Make the `:target` work inside the shadow boundaries by itself, as a separate `:target`.

I should be able to copy any HTML and CSS code and have it run inside the shadow without surprises.
If there is something that shouldn't cross boundaries, then have two, one for document and one for shadow, but both doing what the documentation says it does.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/924#issuecomment-840584959

Received on Thursday, 13 May 2021 14:06:31 UTC