1 // ----------------------------------------------------------------------
2 // shadow-dom-util.js is a set of utility to test Shadow DOM.
4 function getElementByIdConsideringShadowDOM(root, id) {
5 function iter(root, id) {
12 // We don't collect div having a shadow root, since we cannot point it correctly.
13 // Such div should have an inner div to be pointed correctly.
14 for (var child = root.firstChild; child; child = child.nextSibling) {
15 var node = iter(child, id);
20 if (root.nodeType != 1)
23 for (var shadowRoot = internals.youngestShadowRoot(root); shadowRoot; shadowRoot = internals.olderShadowRoot(shadowRoot)) {
24 var node = iter(shadowRoot, id);
32 if (!window.internals)
34 return iter(root, id);