Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'querySelectorAll' of null #41

Closed
webpolis opened this issue Jul 2, 2020 · 2 comments
Closed

Cannot read property 'querySelectorAll' of null #41

webpolis opened this issue Jul 2, 2020 · 2 comments
Assignees
Labels

Comments

@webpolis
Copy link

webpolis commented Jul 2, 2020

Using v2.1.1, Cannot read property 'querySelectorAll' of null is thrown on some elements when clicking.

Go to https://es.wikipedia.org/wiki/Biopel%C3%ADcula and click on any of the pictures at the middle of the page on the right. And then on the X (Close) button at top right.

Related to #19

@webpolis
Copy link
Author

webpolis commented Jul 2, 2020

Well, I think this has to do with the element being removed right away from the DOM tree on click.

This might help others: when catching events, it worth using the useCapture boolean flag in https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

@fczbkk fczbkk self-assigned this Jul 8, 2020
@fczbkk fczbkk added the bug label Jul 8, 2020
fczbkk added a commit that referenced this issue Jul 8, 2020
@fczbkk
Copy link
Owner

fczbkk commented Jul 8, 2020

@webpolis Thanks for the report.

I have created v2.1.2 which should contain a fix for this edge scenario. Attempts to get a selector on parent-less element (this can happen e.g. when element is removed from DOM) should not cause a crash.

I have tested in on the Wikipedia page you linked, I was able to reproduce the problem and it seems to be working after the fix.

@fczbkk fczbkk closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants