<?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>17447</bug_id>
          
          <creation_ts>2012-06-08 21:50:46 +0000</creation_ts>
          <short_desc>[Shadow]: What happens when ShadowRoot instantiated from a different context?</short_desc>
          <delta_ts>2012-11-27 19:11:38 +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>DUPLICATE</resolution>
          <dup_id>15611</dup_id>
          
          <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>18428</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dimitri Glazkov">dglazkov</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>dominicc</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>68887</commentid>
    <comment_count>0</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-06-08 21:50:46 +0000</bug_when>
    <thetext>&quot;Create a new instance of the ShadowRoot object&quot;

what if it is a ShadowRoot from a different iframe (different from window of the new host)?

Then we&apos;ll have to either return a different object from the constructor or do something else. element.createShadowRoot solves this problem, btw.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69176</commentid>
    <comment_count>1</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2012-06-18 02:39:20 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; &quot;Create a new instance of the ShadowRoot object&quot;
&gt; 
&gt; what if it is a ShadowRoot from a different iframe (different from window of
&gt; the new host)?
&gt; 
&gt; Then we&apos;ll have to either return a different object from the constructor or do
&gt; something else.

What is the particular difficulty here?

Isn’t it enough to say

Create a new instance of the ShadowRoot object in the ownerDocument of element

or something like that?

&gt; element.createShadowRoot solves this problem, btw.

First, constructors can return different objects, although it is probably preferable not to do that to make extension easier.

Assuming new ShadowRoot works like a typical JavaScript constructor (ie it does not return a different object), is the only difference between new ShadowRoot(element) and element.createShadowRoot that the prototype chain of the object created by new ShadowRoot(element) is fixed? I don’t think that is particularly a problem; the object can just use the environment of the page creating the ShadowRoot.

If e is an element from a frame f and you do

var s = new ShadowRoot(e);

this just means that

s.constructor === window.ShadowRoot
Object.getPrototypeOf(s) === window.ShadowRoot.prototype
s.ownerDocument === f.contentWindow.document

Admittedly it is weird to mix constructors from one window with content from another, but it works.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78940</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-11-27 19:11:38 +0000</bug_when>
    <thetext>This is no longer an issue, since we switched to use .createShadowRoot in bug 15611

*** This bug has been marked as a duplicate of bug 15611 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>