Skip to content
New issue

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

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

Already on GitHub? # to your account

Potential issue of incorrect logic in the waitForElement util #164

Closed
NoamAnisfeld opened this issue Feb 16, 2024 · 1 comment · Fixed by #165
Closed

Potential issue of incorrect logic in the waitForElement util #164

NoamAnisfeld opened this issue Feb 16, 2024 · 1 comment · Fixed by #165
Labels

Comments

@NoamAnisfeld
Copy link
Contributor

On src/utils.js the util function waitForElement observes a given target node in order to catch a certain element once it's being added to the target node.

However, when it actually looks for the existence of said element it uses document.querySelector rather than target.querySelector. This occurs twice - on the precheck before observing and in the observer callback.

This may lead to a bug when an element which isn't a child of the target node would be incorrectly returned.

@baruchiro
Copy link
Collaborator

Thank you!

You're right. And if you're going to fix it, I think the target needs to be document if it isn't provided.

@baruchiro baruchiro added good first issue Good for newcomers refactor labels Feb 18, 2024
NoamAnisfeld added a commit to NoamAnisfeld/os-scar-overlay that referenced this issue Feb 18, 2024
baruchiro added a commit that referenced this issue Feb 21, 2024
Fix #164

---------

Co-authored-by: Baruch Odem (Rothkoff) <baruchiro@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants