Skip to content

override document.querySelector? #79

Open
@TheDevelolper

Description

@TheDevelolper

So I'm trying to make a web component library that uses a shadow DOM.

I wondered if it was possible to override document.querySelector? Perhaps document.querySelector could be cloned to some other function then your code could call the clone. Then document.querySelector could be overridden to call your deep query selectors?

Then the consumer doesn't have to do anything different from what they're used to?

Activity

NikhilVerma

NikhilVerma commented on Mar 9, 2023

@NikhilVerma

This library still uses native query selector internally. I've modified and published it as a ponyfill (crediting the original project ofcourse) https://www.npmjs.com/package/query-selector-ponyfill

This just needs to be included in your project and it should work out of the box

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      override document.querySelector? · Issue #79 · webdriverio/query-selector-shadow-dom