Re: [shadowdom]: Using :root to specify the insertion point in ::distributed

On Mon, Mar 25, 2013 at 11:39 AM, Dimitri Glazkov <dglazkov@google.com> wrote:
> Good time of day, my stylish colleagues!
>
> While using Shadow DOM's ::distributed pseudo element function, Steve
> (cc'd) stumbled into an interesting use case: he needs to select
> precisely the elements that are distributed to the insertion point,
> but not their descendants. The naive ::distributed(*) selects elements
> and their descendants, inclusively.
>
> It seems that we need a way to refer to the insertion point itself in
> the selector. Tab suggested using ":root":
>
> ::distributed(:root>*)
>
>  It sounds good to me. How does it sound to you?

The justification being that the set of distributed elements are, from
the point of view of the ::distributed() pseudo-element, a document
fragment, and so :root is sensical for the top-most such elements.
(Just as I feel it would be sensical to match :root against the
top-most elements in a DocumentFragment, if queried via
querySelector().)

~TJ

Received on Monday, 25 March 2013 19:24:25 UTC