Walkthrough of what I believe is happening:
- Call
deepQuerySelectorAll passing in an element with a .shadowRoot property. (This also applies to within() queries for the same reason.)
- This library will add just the container to the list of elements to process. Since the container is a shadow root element, this querySelectorAll will return nothing.
- Since that
querySelectorAll returned nothing, the recurse method will exit with a return value of [elem, elem.shadowRoot].
- Then
deepQuerySelectorAll will do a querySelectorAll for each of these values. But at this point, it's just a normal query selector so nested shadow roots are ignored.
As a result, passing in an element with a shadow root to deepQuerySelectorAll, or more notably within() will result in missing any nested shadow roots.
Walkthrough of what I believe is happening:
deepQuerySelectorAllpassing in an element with a.shadowRootproperty. (This also applies towithin()queries for the same reason.)querySelectorAllreturned nothing, therecursemethod will exit with a return value of[elem, elem.shadowRoot].deepQuerySelectorAllwill do aquerySelectorAllfor each of these values. But at this point, it's just a normal query selector so nested shadow roots are ignored.As a result, passing in an element with a shadow root to
deepQuerySelectorAll, or more notablywithin()will result in missing any nested shadow roots.