- From: <bugzilla@jessica.w3.org>
- Date: Mon, 18 Jun 2012 02:39:20 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17447
Dominic Cooney <dominicc@chromium.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dominicc@chromium.org
--- Comment #1 from Dominic Cooney <dominicc@chromium.org> 2012-06-18 02:39:20 UTC ---
(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.
--
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 18 June 2012 02:39:23 UTC