<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23467</bug_id>
          
          <creation_ts>2013-10-09 07:17:03 +0000</creation_ts>
          <short_desc>[Shadow]: clarify ^ and ^^ combinator</short_desc>
          <delta_ts>2014-04-24 00:54:27 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>23062</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Takashi Sakamoto">tasak</reporter>
          <assigned_to name="Hayato Ito">hayato</assigned_to>
          <cc>hayato</cc>
    
    <cc>jackalmage</cc>
    
    <cc>sorvell</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94489</commentid>
    <comment_count>0</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2013-10-09 07:17:03 +0000</bug_when>
    <thetext>We need to clarify how ^ and ^^ combinator work.

I think, at least, we need to discuss:
- case 1: we have multiple shadow roots and each shadow tree has some rules with ^ or ^^, 
- case 2: ^ and ^^ and :host

c.f. http://lists.w3.org/Archives/Public/public-webapps/2013JulSep/0608.html


I wrote the document for this purpose:
https://docs.google.com/document/d/18DsYEiRKg1HmO1UjgHn1CPtwmoXqt8ofmg2Gexdi6Os/edit?usp=sharing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94502</commentid>
    <comment_count>1</comment_count>
    <who name="Steve Orvell">sorvell</who>
    <bug_when>2013-10-09 18:51:26 +0000</bug_when>
    <thetext>There are a couple of things in the linked document that I think are incorrect. I requested comment access but in the meantime, I&apos;ll post my notes here:

The definition of ^^ is incomplete. The second bullet point should be amended as follows:

&quot;B is in a shadow tree which is a descendant tree (c.f. tree of tree concept) of a shadow tree hosted by A *or a descendant of A*.&quot;

In the matching tables:

div ^ div: the cell for div#b and style2 should not match. This is because from style2&apos;s perspective, div#b is not in a shadowRoot. There are a number of other incorrect matches in this and the other tables that seem like the same mistake.

div:host tables: there should be no matches for any of these because div:host should not match the host node. My understanding is that :host matches the host element iff there is no selector to the left (possibly this is not true if it&apos;s inside a css function).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95273</commentid>
    <comment_count>2</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2013-10-24 01:47:15 +0000</bug_when>
    <thetext>I changed the doc permisson.

I would like to confirm:
&gt; div ^ div: the cell for div#b and style2 should not match. This is because from style2&apos;s perspective, div#b is not in a shadowRoot. There are a number of other incorrect matches in this and the other tables that seem like the same mistake.

The style2 is in the oldest shadow root hosted by div#host. So div#b is in a shadow root.

&gt; div:host tables: there should be no matches for any of these because div:host should not match the host node. My understanding is that :host matches the host element iff there is no selector to the left (possibly this is not true if it&apos;s inside a css function).

This is one of topics I would like to discuss.
So &quot;div:host ^ *&quot; and &quot;div:host ^^ *&quot; should not match any elements. Is it ok?

I mean,
(1) div ^ * ==&gt; we can specify any element in a shadow tree when the shadow tree&apos;s shadow host is div.
(2) div:host ==&gt; we cannot specify div + shadow host.

So &quot;^&quot; and &quot;^^&quot; provides another way to specify shadow host (different from :host).

I&apos;m afraid that this behavior confuses web developers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95319</commentid>
    <comment_count>3</comment_count>
    <who name="Steve Orvell">sorvell</who>
    <bug_when>2013-10-24 18:06:20 +0000</bug_when>
    <thetext>I added a few comments to the document.

&gt; So &quot;div:host ^ *&quot; and &quot;div:host ^^ *&quot; should not match any elements. Is it ok?

Yes, this is ok.

&gt; So &quot;^&quot; and &quot;^^&quot; provides another way to specify shadow host (different from
&gt; :host).

I also think this is ok. They go different directions. Using ^ and ^^, you can only target elements in roots below the current scope. Using :host, you can target the host element which is above the current scope.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95337</commentid>
    <comment_count>4</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2013-10-25 06:18:51 +0000</bug_when>
    <thetext>Thank you.

So I have another concern about ^ and ^^.

Suppose that we have &quot;div ^ *&quot;.

(a) &quot;div&quot; in a shadow tree cannot match the tree&apos;s shadow host.

div[id=host]
    #shadow-root
        style
            div { border: 1px solid green; }


So div#host&apos;s border color should not green. This means, [tag] and [shadow host] has no intersection.

(b) &quot;div:host&quot; in a shadow tree cannot match the tree&apos;s shadow host.

Because of no intersection between [tag] and [shadow host], &quot;div:host&quot; cannot match any shadow hosts.

I think, we have already agreed with the above (a) and (b).
So I&apos;m thinking of the following (c).

(c) the &quot;div&quot; of &quot;div ^ *&quot; in a shadow tree can match the tree&apos;s shadow host?

If the div can match the shadow host, [tag] and [shadow host] has some intersection... 
So (a) and (b) should match?

Or we should use PseudoElement? e.g. &quot;div ^ *&quot; is something like ::hat(div, *)?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95341</commentid>
    <comment_count>5</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2013-10-25 10:39:41 +0000</bug_when>
    <thetext>I would like to confirm one thing.

Suppose that we have the following tree:

div[id=host]
    #shadow-root
        style
            div ^ div{ border: 1px solid green; }
        div[id=A]


The div ^ div should match div[id=A]?

i.e. the left &quot;div&quot; of the style in a shadow tree can match div[id=host]?

I think, the left &quot;div&quot; should not match div[id=host].

So div[id=A] doesn&apos;t have green border.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95349</commentid>
    <comment_count>6</comment_count>
    <who name="Steve Orvell">sorvell</who>
    <bug_when>2013-10-25 15:33:51 +0000</bug_when>
    <thetext>Re: commment #4:

&gt; (a) &quot;div&quot; in a shadow tree cannot match the tree&apos;s shadow host.
&gt; (b) &quot;div:host&quot; in a shadow tree cannot match the tree&apos;s shadow host.

Yup, agree on both.

&gt; (c) the &quot;div&quot; of &quot;div ^ *&quot; in a shadow tree can match the tree&apos;s shadow host?

No, why would it? It cannot because of (a).

&gt; Or we should use PseudoElement? e.g. &quot;div ^ *&quot; is something like ::hat(div, *)?

Can you explain what problem you&apos;re solving here?

If the concern is how to write a selector that does: &quot;from a style in a shadowRoot, match a div in any of the host&apos;s shadowRoot&apos;s if the host is a div&quot; then that is:

:host(div:host) ^ div</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95350</commentid>
    <comment_count>7</comment_count>
    <who name="Steve Orvell">sorvell</who>
    <bug_when>2013-10-25 15:35:48 +0000</bug_when>
    <thetext>Re: comment #5

&gt; The div ^ div should match div[id=A]?

It should not.

&gt; I think, the left &quot;div&quot; should not match div[id=host].
&gt; So div[id=A] doesn&apos;t have green border.

Yup, we agree.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95381</commentid>
    <comment_count>8</comment_count>
    <who name="Steve Orvell">sorvell</who>
    <bug_when>2013-10-26 00:48:31 +0000</bug_when>
    <thetext>Thanks for posting the document above. In conjunction with https://www.w3.org/Bugs/Public/show_bug.cgi?id=23636, there were enough changes that I went ahead and made a copy with some modifications:

https://docs.google.com/a/chromium.org/document/d/1cxW4MtsDbCUTdnr_7lxwrlywmpKj04aD5TRVKjd446o/edit#</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104305</commentid>
    <comment_count>9</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2014-04-24 00:54:27 +0000</bug_when>
    <thetext>Let me close this bug.
I believe CSS scoping spec [1] has already addressed this feature.

[1]: http://dev.w3.org/csswg/css-scoping/</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>