You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// see https://developer.mozilla.org/en-US/docs/Web/API/NodeFiltervarShadowHostFilter={acceptNode: function(node){returnnode.shadowRoot ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;// possible optimization using FILTER_REJECT to skip checking the children}};functionfindShadowHosts(context,deep){// see https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalkervarshadowHostFinder=document.createTreeWalker(// root element to start search incontext||document.documentElement,// element type filterNodeFilter.SHOW_ELEMENT,// custom NodeFilter filterShadowHostFilter);varshadowHosts=[];while(shadowHostFinder.nextNode()){shadowHosts.push(shadowHostFinder.currentNode);if(deep){varchildren=findShadowHosts(shadowHostFinder.currentNode.shadowRoot,deep);shadowHosts=shadowHosts.concat(children);}}returnshadowHosts;}// find all ShadowHosts recursivelyfindShadowHosts(document.documentElement,true);
query/focusable in "quick" mode (default) requires the support of "Shadow Piercing Descendant Combinator" for Shadow DOM introspection, "strict" mode does not (and will therefore work in Firefox).
>>>
,/deep/
and::shadow
have been deprecated, see https://www.chromestatus.com/features/6750456638341120We can traverse the DOM ourselves using Sizzle (probably overkill) or TreeWalker
The text was updated successfully, but these errors were encountered: