[webcomponents] [Shadow] Need equivalent of ownerDocument for Elements in a shadow tree to get to their ShadowRoot (#315)

For an element participating in a shadow tree (and only interested in performing DOM searches scoped to its own shadow tree, it will often be necessary to use it's "owner shadow root" object to perform these searches. For example, shadowRoot.getElementById, or shadowRoot.querySelector. However, there is no convenient link from an element in a shadow tree to grab its shadow root container.

I propose extending Node with a new property ```ownerShadowRoot``` (or possibly ```parentShadowRoot```) in order to provide this linkage.

This property also doubles as a convenient check for "am I in a shadow tree", as the ```ownerShadowRoot``` property would be null for any node in the document tree.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/315

Received on Thursday, 3 September 2015 23:25:39 UTC