Re: ::distributed and relative selectors (Was Re: [shadowdom]: Using :root to specify the insertion point in ::distributed)

On Fri, Apr 19, 2013 at 2:44 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Thu, Apr 18, 2013 at 1:44 AM, Hayato Ito <hayato@google.com> wrote:
>> The subject was changed.
>> On Wed, Apr 3, 2013 at 9:01 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>>> On Tue, Apr 2, 2013 at 3:01 PM, Dimitri Glazkov <dglazkov@google.com> wrote:
>>>> Using scope-relative approach (which I love), what does
>>>> ::distributed(:scope) represent?
>>>
>>> Nothing.  The scope element is a theoretical construct here
>>> representing a container for all the distributed elements, not a real
>>> element that you can do something with.
>>
>> I am now implementing relative selectors in blink.
>> As the first usecase of relative selectors, I've tried to use it in
>> '::distributed(..)' pseudo elements.
>>
>> Now I have a question. Let me use the following deduction:
>>
>> 1). content::distributed(> .hello)               ->  Please assume this matches.
>> 2). content::distributed(:scope > .hello)        -> Matches. (1 and 2
>> should be equivalent acccording to the defintion of relative
>> selectors).
>> 3). content::distributed(*:scope > .hello)       -> Matches.
>> 4). content::distributed(content:scope > .hello) -> Matches.
>> 5). content::distributed(content > .hello)       -> Should not match.
>
> I think that, for the purpose of ::distributed, the scope element
> should be an abstract container, not the actual <content> element.
> This container would act as an element for the purposes of selectors,
> but it has no tagname or any other quality to select on.  So, #1, #2,
> and #3 would match, but #4 and #5 wouldn't, because the scoping
> element isn't named "content".

I noticed that we don't need 4) and 5) to prove contradiction. See the
following example, introducing 4':

1). content::distributed(> .hello)               ->  Please assume this matches.
2). content::distributed(:scope > .hello)        -> Matches. (1 and 2
should be equivalent according to the defintion of relative
selectors).
3). content::distributed(*:scope > .hello)       -> Matches.
4'). content::distributed(* > .hello)       -> Should not match.

3) matches, but 4') should not match.

I think it is hard to justify using :scope in this context. I am
afraid that we should handle ':scope' in this context very *tricky* in
implementing this. Maybe the spec is wrong.
My proposal is using ':root' as suggested in the original thread.


--
Hayato

Received on Friday, 19 April 2013 00:28:04 UTC