8000 Delegate DOM events? · Issue #75 · clearwater-rb/clearwater · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000
Delegate DOM events? #75
Open
Open
@jgaskins

Description

@jgaskins

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0