<?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>18513</bug_id>
          
          <creation_ts>2012-08-09 21:51:10 +0000</creation_ts>
          <short_desc>[Shadow]: Consider re-projecting children in nested shadow DOM subtrees</short_desc>
          <delta_ts>2012-10-18 20:25:53 +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>
          <dependson>19436</dependson>
          <blocked>18428</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dimitri Glazkov">dglazkov</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>dominicc</cc>
    
    <cc>hayato</cc>
    
    <cc>shinyak</cc>
    
    <cc>sjmiles</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>71993</commentid>
    <comment_count>0</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-09 21:51:10 +0000</bug_when>
    <thetext>Consider this scenario:

For Shadow DOM subtrees A and B, with A nesting inside B, there is an insertion point IPa  in tree A that matches some (or all) children of the shadow host [Ah].

At the same time, an insertion point IPb in tree B is positioned as a direct child of A.

The shadow host [Bh] of tree B has one child C.

 [Bh] -- B
   |        |
  C      [Ah] -- A
            |          |
          IPb        IPa

The question is this:

If C is matched by IPb and C is matched by IPa, is C rendered as child of:
a) Ah
b) A?

As spec&apos;d today, the answer is [Ah], which is a bit weird, since it seems logically like it should follow the same rendering rules as any other children of [Ah]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71994</commentid>
    <comment_count>1</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-09 21:56:28 +0000</bug_when>
    <thetext>I suck at text diagrams.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71995</commentid>
    <comment_count>2</comment_count>
    <who name="Steve Orvell">sorvell</who>
    <bug_when>2012-08-09 22:09:20 +0000</bug_when>
    <thetext>Since A exists for Ah, C will not actually be rendered since it is replaced by A.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71996</commentid>
    <comment_count>3</comment_count>
    <who name="Scott Miles">sjmiles</who>
    <bug_when>2012-08-09 22:12:12 +0000</bug_when>
    <thetext>For clarity, Steve Orvell&apos;s comment refers to the behavior of the current spec, not the proposal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71997</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-09 22:14:09 +0000</bug_when>
    <thetext>That seems like a sucky behavior, then.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71998</commentid>
    <comment_count>5</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-09 22:14:33 +0000</bug_when>
    <thetext>For clarity, my last comment refers to the spec, not the proposal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72097</commentid>
    <comment_count>6</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2012-08-13 04:54:13 +0000</bug_when>
    <thetext>(In reply to comment #0)
 &gt; If C is matched by IPb and C is matched by IPa, is C rendered as child of:
&gt; a) Ah
&gt; b) A?
&gt;
&gt; As spec&apos;d today, the answer is [Ah]

Can you clarify whether | is a sibling or child relationship? I am going to assume it is a child. Are A and B elements or ShadowRoots? I assume that they are *elements* because you mentioned C being rendered as a &quot;child of … A&quot; and since ShadowRoots are themselves not rendered, A must be an element.

If those assumptions are right*, this question does not make sense to me for two reasons:

First, whether C is matched by IPa or not is immaterial, since insertion points match the children of host elements. C is not a child of [Ah], thus, it is not matched by IPa.

Second, it is not possible for C to rendered as a child of [Ah] since [Ah] has Shadow DOM with a top-level element A, hence the only thing rendered as a child of [Ah] will be A.

My conclusion is that if C is rendered, it is rendered as the child of A. Whether it is rendered depends on whether IPa also matches IPb (you mentioned it matches C – whether it matches IPb in addition to that.)

&gt; , which is a bit weird, since it seems
&gt; logically like it should follow the same rendering rules as any other children
&gt; of [Ah]

I think this is confusing distribution and rendering. As far as I can see the rules for distribution and rendering are being applied consistently.

* This doesn’t make sense to me under other plausible assumptions, so if I got the assumptions wrong, help me out here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72448</commentid>
    <comment_count>7</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-20 21:45:50 +0000</bug_when>
    <thetext>Here&apos;s the modification that would be necessary to make this happen.

Replace of (3) in tree composition algorithm with: 

For each child node of HOST
    Let CHILD be this node
    If CHILD is an insertion point:
        Add results of a tree composition algorithm of this insertion point&apos;s shadow DOM subtree to POOL
        Otherwise, add CHILD to POOL

Basically, this builds a recursive traversal of the nesting trees into the algorithm.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72890</commentid>
    <comment_count>8</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-28 17:30:53 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; Basically, this builds a recursive traversal of the nesting trees into the
&gt; algorithm.

Scratch that. I&apos;ve done a bit more experimenting and this is not sufficient.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75324</commentid>
    <comment_count>9</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-04 22:40:41 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/webcomponents/rev/06da13b003eb</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75325</commentid>
    <comment_count>10</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-04 22:55:13 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/webcomponents/rev/16e7f84e5f88</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75326</commentid>
    <comment_count>11</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-04 22:57:30 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/webcomponents/rev/418286b9a95e</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75421</commentid>
    <comment_count>12</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-05 22:12:50 +0000</bug_when>
    <thetext>Grr. In order to correctly specify behavior of the adjusted parent algo, I need to add an extra input (and output) for context node.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75424</commentid>
    <comment_count>13</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-05 22:32:21 +0000</bug_when>
    <thetext>For the tree structure:

A--[SrA]
|    |
B    +-C-----[SrC]
       |       |
       +-&lt;D&gt;   +--E-----[SrE]
                  |       |
                  +-&lt;F&gt;   +--G-----[SrH]
                             |       |
                             +-&lt;I&gt;   +--&lt;J&gt;


Where all insertion points select &quot;B&quot;, we should have the following ancestors list:

B &lt;D&gt; &lt;F&gt; &lt;I&gt; &lt;J&gt; [SrH] G [SrE] E [SrC] C [SrA] A

It&apos;s easy to arrive at &lt;D&gt;. Now, in order to determine &lt;F&gt;, we need to know both:

1) &lt;D&gt;, the node for which we&apos;re determining the parent
2) B, the node that is being reprojected.

To summarize, we need the node that is being projected as the second argument for the adjusted parent parent algorithm.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75425</commentid>
    <comment_count>14</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-05 22:34:06 +0000</bug_when>
    <thetext>Unless, of course, we simply skip &lt;D&gt; &lt;F&gt; &lt;I&gt; from the ancestor chain.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76609</commentid>
    <comment_count>15</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-18 19:55:33 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/webcomponents/rev/6da10e050ff8
http://dvcs.w3.org/hg/webcomponents/rev/1607d5afd8af</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76612</commentid>
    <comment_count>16</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-10-18 20:25:53 +0000</bug_when>
    <thetext>yay.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>