Skip to content

deepQuerySelectorAll fails to recurse into descendant shadow roots #39

@CreativeTechGuy

Description

@CreativeTechGuy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions