<?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>16317</bug_id>
          
          <creation_ts>2012-03-12 01:04:55 +0000</creation_ts>
          <short_desc>[Shadow]: Clarify the meaning of /select/ and upper boundary encapsulation, styling</short_desc>
          <delta_ts>2012-10-23 23:05:57 +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>All</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>16009</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dominic Cooney">dominicc</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>hayato</cc>
    
    <cc>tasak</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>65333</commentid>
    <comment_count>0</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2012-03-12 01:04:55 +0000</bug_when>
    <thetext>Section 7.3 describes CSS selectors like:

.some-insertion-point /select/ div.special

where the left-hand side selects an insertion point and the right-hand side selects an element distributed to that point. Hence the left-hand side is in a shadow tree and the right-hand side is in a different level.

However Section 5.1 states:

The selectors must not cross the shadow boundary

And the algorithm at the start of Section 7 describes rules in the document applying to nodes in the shadow tree if apply-author-styles is set, but not rules in the shadow tree applying to nodes in the document (ie styles flow at most &quot;one way&quot;, if at all.)

The intent of the /select/ combinator seems to be to style nodes in the document from rules in the document (by the algorithm in Section 7, rules in the shadow tree could not apply to nodes in the document.) However then the selector violates upper-boundary encapsulation by mentioning an insertion point in the shadow tree.

This section is unclear and needs to be clarified. Is upper-boundary encapsulation relaxed? Are there exceptions for applying style rules that use the /select/ combinator? Is the combinator expected to work in querySelector as well as stylesheets?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65369</commentid>
    <comment_count>1</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-03-12 19:14:54 +0000</bug_when>
    <thetext>I need to rework the rule applicability algorithm.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65465</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-03-13 21:18:50 +0000</bug_when>
    <thetext>There is also going to be an exception with ::host pseudo-element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65631</commentid>
    <comment_count>3</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-03-15 21:57:13 +0000</bug_when>
    <thetext>Step 1: Reworked the rule applicability algorithm to use &quot;applicable in tree&quot;, rather than &quot;applicable to node&quot;. This allows us to separate the notion of &quot;applicable&quot; and &quot;matching&quot;.

For example, &quot;.some-insertion-point /select/ div.special&quot; is _applicable_ in a shadow DOM subtree, even though it _matches_ nodes outside of the shadow DOM tree.

http://dvcs.w3.org/hg/webcomponents/rev/8d191f75a97d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65633</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-03-15 22:15:07 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Step 1: Reworked the rule applicability algorithm to use &quot;applicable in tree&quot;,
&gt; rather than &quot;applicable to node&quot;. This allows us to separate the notion of
&gt; &quot;applicable&quot; and &quot;matching&quot;.
&gt; 
&gt; For example, &quot;.some-insertion-point /select/ div.special&quot; is _applicable_ in a
&gt; shadow DOM subtree, even though it _matches_ nodes outside of the shadow DOM
&gt; tree.
&gt; 
&gt; http://dvcs.w3.org/hg/webcomponents/rev/8d191f75a97d

Oops, that was http://dvcs.w3.org/hg/webcomponents/rev/b2f0d136b2c5.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65634</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-03-15 22:15:43 +0000</bug_when>
    <thetext>Step 2: Relaxed the upper-boundary encapsulation restrictions to only upper boundary cases:

http://dvcs.w3.org/hg/webcomponents/rev/cf9aec2d779c</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65636</commentid>
    <comment_count>6</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-03-15 22:22:02 +0000</bug_when>
    <thetext>Step 3: Made sure that the spec talks in term of rule _applicability_ in trees, rather than matching nodes.

http://dvcs.w3.org/hg/webcomponents/rev/a5358f551b7f</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65637</commentid>
    <comment_count>7</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-03-15 22:33:19 +0000</bug_when>
    <thetext>Step 5: Tightened back the lower-boundary encapsulation http://dvcs.w3.org/hg/webcomponents/rev/c2f82425ba8d

Do I win?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66037</commentid>
    <comment_count>8</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2012-03-26 06:20:47 +0000</bug_when>
    <thetext>You win.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76948</commentid>
    <comment_count>9</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-10-23 11:00:51 +0000</bug_when>
    <thetext>I would like to confirm one thing. According to the spec, the following selector doesn&apos;t work:

.some-insertion-point1 /select/ .some-insertion-point2 /select/ div.special

Is this correct?

Best regards,
Takashi Sakamoto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76951</commentid>
    <comment_count>10</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-10-23 11:13:08 +0000</bug_when>
    <thetext>I&apos;m sorry. I would like to confirm one more thing.
The spec only says:

Otherwise, if RULE is either an @host @-rule or contains a select reference combinator and RULE is declared in shadow root style sheets:
- Let BOTTOM the shadow DOM subtree, with which these shadow root style sheets are associated
- If the shadow host of BOTTOM is in TREE, then RULE is applicable in TREE.

RULE is applicable in TREE means,
----
Suppose that there are several different shadow hosts, e.g.

&lt;shadow host1&gt;
...
&lt;shadow host2&gt;
..
&lt;shadow hostN&gt;

Every shadow host&apos;s shadow dom subtree has some rule which has /select/. If the rules are very simple, e.g. content /select/ * or shadow /select/ *, shadow host1&apos;s rule can be applied to shadow hostN?
----

I think, shadow host1&apos;s rules which have /select/ can be applied to only shadow host1&apos;s children. shadow hostN&apos;s rules which have /select/ can be applied to only shadow hostN&apos;s children.

So probably we need some comment about &quot;scope&quot; of rules which has /select/.

Best regards,
Takashi Sakamoto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76953</commentid>
    <comment_count>11</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-10-23 11:26:19 +0000</bug_when>
    <thetext>*** Bug 19663 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76954</commentid>
    <comment_count>12</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-10-23 11:32:00 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; I would like to confirm one thing. According to the spec, the following
&gt; selector doesn&apos;t work:
&gt; 
&gt; .some-insertion-point1 /select/ .some-insertion-point2 /select/ div.special
&gt; 
&gt; Is this correct?
&gt; 
&gt; Best regards,
&gt; Takashi Sakamoto

I mean, multiple shadow case and nested shadow case.

Best regards,
Takashi Sakamoto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76961</commentid>
    <comment_count>13</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-10-23 13:27:04 +0000</bug_when>
    <thetext>
&gt; I mean, multiple shadow case and nested shadow case.

I forgot to ask about whether /select/ rules in inert shadow dom subtrees should be applied or not.

Suppose that there exist the following DOM tree:

&lt;host&gt; ---- &lt;sr1&gt; ---- &lt;sr2&gt; ----- &lt;sr3&gt; ... --- &lt;sr N&gt;
   |
   +--child

and all shadow roots have &lt;style&gt; which has /select/ rules. But some of shadow roots have no &lt;shadow&gt;, i.e. inert shadow roots.

I think, this should work in the same mannar as @host @-rules. /select/ rules in inert shadow roots should not be applied. Is this correct?

And I think,/select/ rules in younger shadow DOM subtree should have higher priority than rules in older shadow DOM subtree.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76962</commentid>
    <comment_count>14</comment_count>
    <who name="Takashi Sakamoto">tasak</who>
    <bug_when>2012-10-23 13:29:37 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; I would like to confirm one thing. According to the spec, the following
&gt; selector doesn&apos;t work:
&gt; 
&gt; .some-insertion-point1 /select/ .some-insertion-point2 /select/ div.special
&gt; 
&gt; Is this correct?
&gt; 
&gt; Best regards,
&gt; Takashi Sakamoto

I think, if we don&apos;t have any shadow re-projection, we need something like &quot;shadow /select/ shadow /select/ ...&quot; to support multiple shadow root case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76986</commentid>
    <comment_count>15</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-23 21:51:08 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; I would like to confirm one thing. According to the spec, the following
&gt; selector doesn&apos;t work:
&gt; 
&gt; .some-insertion-point1 /select/ .some-insertion-point2 /select/ div.special
&gt; 
&gt; Is this correct?

That wasn&apos;t the intention of the spec. Seems like a bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76987</commentid>
    <comment_count>16</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-23 21:53:01 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; I&apos;m sorry. I would like to confirm one more thing.
&gt; The spec only says:
&gt; 
&gt; Otherwise, if RULE is either an @host @-rule or contains a select reference
&gt; combinator and RULE is declared in shadow root style sheets:
&gt; - Let BOTTOM the shadow DOM subtree, with which these shadow root style
&gt; sheets are associated
&gt; - If the shadow host of BOTTOM is in TREE, then RULE is applicable in TREE.
&gt; 
&gt; RULE is applicable in TREE means,
&gt; ----
&gt; Suppose that there are several different shadow hosts, e.g.
&gt; 
&gt; &lt;shadow host1&gt;
&gt; ...
&gt; &lt;shadow host2&gt;
&gt; ..
&gt; &lt;shadow hostN&gt;
&gt; 
&gt; Every shadow host&apos;s shadow dom subtree has some rule which has /select/. If
&gt; the rules are very simple, e.g. content /select/ * or shadow /select/ *,
&gt; shadow host1&apos;s rule can be applied to shadow hostN?
&gt; ----
&gt; 
&gt; I think, shadow host1&apos;s rules which have /select/ can be applied to only
&gt; shadow host1&apos;s children. shadow hostN&apos;s rules which have /select/ can be
&gt; applied to only shadow hostN&apos;s children.

Right.

&gt; 
&gt; So probably we need some comment about &quot;scope&quot; of rules which has /select/.

Yup.

Also -- please file a new bug in the future, rather than reusing an old bug. I&apos;d love to keep the same system as in WebKit here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76988</commentid>
    <comment_count>17</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-23 21:56:09 +0000</bug_when>
    <thetext>(In reply to comment #13)
&gt; &gt; I mean, multiple shadow case and nested shadow case.
&gt; 
&gt; I forgot to ask about whether /select/ rules in inert shadow dom subtrees
&gt; should be applied or not.
&gt; 
&gt; Suppose that there exist the following DOM tree:
&gt; 
&gt; &lt;host&gt; ---- &lt;sr1&gt; ---- &lt;sr2&gt; ----- &lt;sr3&gt; ... --- &lt;sr N&gt;
&gt;    |
&gt;    +--child
&gt; 
&gt; and all shadow roots have &lt;style&gt; which has /select/ rules. But some of
&gt; shadow roots have no &lt;shadow&gt;, i.e. inert shadow roots.
&gt; 
&gt; I think, this should work in the same mannar as @host @-rules. /select/
&gt; rules in inert shadow roots should not be applied. Is this correct?

Can you explain why this matters? If the tree is inert, the fact that the rule applies or not is not possible to detect -- right?

&gt; 
&gt; And I think,/select/ rules in younger shadow DOM subtree should have higher
&gt; priority than rules in older shadow DOM subtree.

You mean specificity?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76989</commentid>
    <comment_count>18</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-23 21:58:21 +0000</bug_when>
    <thetext>(In reply to comment #14)
&gt; (In reply to comment #9)
&gt; &gt; I would like to confirm one thing. According to the spec, the following
&gt; &gt; selector doesn&apos;t work:
&gt; &gt; 
&gt; &gt; .some-insertion-point1 /select/ .some-insertion-point2 /select/ div.special
&gt; &gt; 
&gt; &gt; Is this correct?
&gt; &gt; 
&gt; &gt; Best regards,
&gt; &gt; Takashi Sakamoto
&gt; 
&gt; I think, if we don&apos;t have any shadow re-projection, we need something like
&gt; &quot;shadow /select/ shadow /select/ ...&quot; to support multiple shadow root case.

There is not /select/ attribute on &quot;shadow&quot;. Can you explain why we would need something like this? (possibly on a new bug :P)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76997</commentid>
    <comment_count>19</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-23 22:53:10 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; I would like to confirm one thing. According to the spec, the following
&gt; selector doesn&apos;t work:
&gt; 
&gt; .some-insertion-point1 /select/ .some-insertion-point2 /select/ div.special
&gt; 
&gt; Is this correct?
&gt; 
&gt; Best regards,
&gt; Takashi Sakamoto

Filed bug 19681 to track fixing this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77002</commentid>
    <comment_count>20</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-23 23:05:50 +0000</bug_when>
    <thetext>Closing this bug. Please file new bugs for each specific problem.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>