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

Delegate DOM events? #75

Open
jgaskins opened this issue Jan 14, 2018 · 0 comments
Open

Delegate DOM events? #75

jgaskins opened this issue Jan 14, 2018 · 0 comments

Comments

@jgaskins
Copy link
Member

We currently place DOM event handlers on the elements' on#{whatever} properties. I've heard that this is considered a poor practice, performance-wise. I haven't found any hard data to back that up and my own performance tests show no meaningful difference.

I tested it by adding dom-delegator and updating on#{event_name} in the properties hash translation to become ev-#{event_name}. The app worked exactly as it had, and event handler usage became constant (instead of increasing until the previous handlers were GCed as with setting onclick), but CPU time and memory usage did not change by any meaningful amount across several test runs both before and after.

What I'm wondering is, is there any real-world benchmarks for recent browsers showing that using event delegation is truly more efficient?

@jgaskins jgaskins self-assigned this Jan 14, 2018
@jgaskins jgaskins removed their assignment May 10, 2024
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