oddbird / popover-polyfill

Polyfills the HTML popover attribute and showPopover/hidePopover/togglePopover methods onto HTMLElement, as well as the popovertarget and popovertargetaction attributes on <button> elements.
https://popover.oddbird.net
BSD 3-Clause "New" or "Revised" License
269 stars 14 forks source link

Polyfill breaks other libraries that pass null/undefined to document.querySelector #104

Closed p-ob closed 1 year ago

p-ob commented 1 year ago

To demonstrate this, you can see this in action if you go to the demo in a browser that doesn't natively implement popover, and in the console execute:

document.querySelector(null);

This causes some interop issues with other 3rd party libraries.

Expected behavior

document.querySelector does not throw an error, and returns null.

Actual behavior

Error thrown: Uncaught TypeError: can't access property "includes", selector is null

Firefox:
image