[Bug 22141] [Shadow]: Need mechanism to tell if an element in a ShadowRoot has been inserted into the Document

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141

--- Comment #7 from Hayato Ito <hayato@chromium.org> ---
To interpret the current spec literally, I think:

- document.contains should always return *false* if the argument node is in a
shadow tree, as Erik said in comment #3. There is no ancestor/descendant
relationship if they are in the different node trees.

I understand that this might cause a very bad user experience.

How do we proceed? Let me propose some ideas.

A) Change the semantics of node.contains so that it should consider the tree of
trees.
   That means we are extending ancestor/descendant relationships beyond one
node tree. I am afraid that we have to do *monkey-patch* to `node.contains` in
the Shadow DOM spec.

B) Leave node.contains as is. That means if the context object and argument
node are in the different node trees, it always returns *false*.

 As alternative, we should provide a new API, such as node.inComposedTree().
node.inComposedTree return true if and only if:
   The node participates in the composed tree whose root node is document.

C) Better ideas are welcome.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 12 March 2014 04:55:14 UTC