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

Why does addEventListener attach to not node but window? #170

Open
studioTeaTwo opened this issue Oct 15, 2024 · 0 comments
Open

Why does addEventListener attach to not node but window? #170

studioTeaTwo opened this issue Oct 15, 2024 · 0 comments

Comments

@studioTeaTwo
Copy link

studioTeaTwo commented Oct 15, 2024

I am going to use it in the case of multiple nodes and the repetition of node.append/node.remove.
This can cause problems because removeEventListener can not properly find the corresponding Listeners, leaving Listeners referencing the removed Node.

Current core code is:

	const listen = addEventListener;

	listen('pointerdown', drag_start, false);
	listen('pointerup', drag_end, false);
	listen('pointermove', drag, false);

I think it's better:

	const listen = node.addEventListener;

	listen('pointerdown', drag_start, false);
	listen('pointerup', drag_end, false);
	listen('pointermove', drag, false);
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