Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes delegated event performance based on container element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "delegated event performance based on container element" Watch "delegated event performance based on container element" New topic
Author

delegated event performance based on container element

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

When using delegated events and the on() function, is there any significant performance loss if the container element is something like the body element? I usually try and find the closest parent that I know will be on the page. My assumption is that the less jQuery has to navigate from container to handler, the better. But I really don't know that for sure.


GenRocket - Experts at Building Test Data
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are talking milliseconds of difference. If you need high performance in a game, closer is better. For a form, does not make a difference.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thanks, Eric.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: delegated event performance based on container element