[Bug 19684] [Shadow]: shadow reference combinator should be css function.

https://www.w3.org/Bugs/Public/show_bug.cgi?id=19684

--- Comment #4 from Takashi Sakamoto <tasak@google.com> ---
I read reference combinator again.
So I think, I probably misunderstood "host language" and "reference".

(1) reference combinator especially depends on the first value.
(2) the attribute is solved in the context of the first value.

So if "content /select/ div.special" is given, since currently "select"
attribute is used by only <content>, we can know only <content> has valid host
language / valid reference about /select/.

>From the viewpoint of implementation, we should know whether some given
attribute is valid for some element. RuleSets are registered with TREESCOPE
according to the context.

I think, this might be bike-shedding. But I found one implementation problem,
fallback case - idref. 

If ".some /select/ div.special" is given in some shadow root stylesheet and
"<div class=some select=#a>" and "<div class=special id=a>" exists in the
shadow root's subtree,

<#shadow-root>
   <style>
   .some /select/ div.special { color: red; }
   </style>
   <div class=some select=#a></div>
   <div class=special></div>
</#shadow-root>

Since the "<div class=some>" has no host languages and no valid context for
"select", we have to see idref as fallback. The spec says:

"Unless the host language defines a different syntax for expressing this
relationship, this relationship is considered to exist if the value of the
specified attribute on the first element is an IDREF or an ID selector
referencing the second element. "

But web developers will not probably add "select" to other elements except
"<content>". So we would not see such fallback case...

Best regards,
Takashi Sakamoto

(In reply to comment #2)
> (In reply to comment #1)
> > (In reply to comment #0)
> > > I think, /select/ is a little confusing for web developers. It would be
> > > better to use css function instead, e.g.
> > > - distributed-into(), or
> > > - selected-by()
> > > 
> > > I will write the reason why I suggest css function.
> > > Current shadow dom spec says, 
> > > 
> > > - The combinator value must be select
> > > - The first compound selector of the combinator must match an insertion point
> > > - The second compound selector must match an element, distributed to this
> > > insertion point
> > > 
> > > Its example is .some-insertion-point /select/ div.special.
> > > 
> > > However, any element can have "select". For example, users can write '<div 
> > > class="some-insertion-point" select="...">'.
> > > 
> > > So it is difficult to know whether /select/ is just reference combinator or
> > > shadow reference combinator.
> > 
> > "select" is not a valid attribute for a "div".  I don't see what is
> > difficult.
> 
> Would you mean whether reference combinator works or not depends on whether
> the attribute is valid or not?
> 
> I looked at the reference combinator's spec and couldn't found that
> attribute selector only works for valid attribute or something. I could find
> the following:
> 
> "attribute selectors must be considered to match an element if that element
> has an attribute that matches the attribute represented by the attribute
> selector."
> 
> > > For example,
> > > <div class="shadow-host">
> > >    <#shadow-root>
> > >       <style>
> > >       .some-insertion-point /select/ div.special { color: red; }
> > >       </style>
> > >       <div class=".some-insertion-point" select="#B">
> > >       <content class=".some-insertion-point">
> > >       <div id="B">This text is red?</div>
> > >    </#shadow-root>
> > >    <div class="special">This text should be red!</div>
> > > </div>
> > > 
> > > The ".some-insertion-point /select/ div.special { color: red; }" should be
> > > applied to distributed node or just div in shadow dom subtree? Both?
> > > 
> > > The most difficult thing is that we cannot decide whether
> > > ".some-insertion-point" points really insertion points or not when parsing
> > > the rule.
> > > 
> > > So by using css function, we can write:
> > > - div.special:distributed-into('.some-insertion-point') { color: red; }, or
> > > - div.special:selected-by('.some-insertion-point') { color: red; }
> > > 
> > > This is very easy to know that the style should be applied to distributed
> > > nodes.
> > > 
> > > What do you think about this?
> > 
> > I think the example you brought up is rather weak. I honestly don't see a
> > problem with this. Thus, in my opinion, this is bike-shedding.
> 
> If shadow reference combinator doesn't cross any treescope boundaries, I
> agree with you that this is not a problem.
> However, the current spec says that sometimes reference combinator can cross
> treescope boundary. I feel that it might be inconsistent.
> 
> > Also, you need to argue with Tab and the CSS WG about this. He is the one
> > who recommended to use reference combinator.
> > 
> > Also, here's more information on the reference combinator:
> > http://www.w3.org/TR/selectors4/#idref-combinators

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 24 October 2012 06:15:19 UTC