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

Wrong element is getting event listeners. #24

Open
necat1 opened this issue Jan 21, 2024 · 0 comments
Open

Wrong element is getting event listeners. #24

necat1 opened this issue Jan 21, 2024 · 0 comments

Comments

@necat1
Copy link

necat1 commented Jan 21, 2024

When I have div with click event listener:
<div id="1"></div>
And I construct new document with added div above previous one, so new document looks like:

<div></div>
<div id="1"></div>

So when i replace current document with new document, event listener is now on div without id, and div with id 1 has no event listener:

diff(document, newDoc);

But when div with id is above the newly added element, than the div keeps the event listener like expected:

<div id="1"></div>
<div></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant