This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
"Create a new instance of the ShadowRoot object" what if it is a ShadowRoot from a different iframe (different from window of the new host)? Then we'll have to either return a different object from the constructor or do something else. element.createShadowRoot solves this problem, btw.
(In reply to comment #0) > "Create a new instance of the ShadowRoot object" > > what if it is a ShadowRoot from a different iframe (different from window of > the new host)? > > Then we'll have to either return a different object from the constructor or do > 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? > 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.
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 ***