[jQuery] Re: Question about Event Handling Optimization

2008-06-30 Thread ..:: sheshnjak ::..
You're not loosing anything by modulizing. All event definitions will still be included in your code (if you put them all in one js file, of course). Only difference is that they are not all evaluated, just ones you need. Win-win. Only thing you will loose is half an hour to put things right. On

[jQuery] Re: Question about Event Handling Optimization

2008-06-27 Thread jack
Thanks everyone for your input. My other concern is that if i completely modularize code to seperate includes, then i will lose the one-time download / precaching benefit of a single js download. Perhaps the best approach is to make sure that unnecessary event handlers arent attached using someth

[jQuery] Re: Question about Event Handling Optimization

2008-06-27 Thread ..:: sheshnjak ::..
It actually does have a performance impact, even though we can't always "see it" on modern processors and javascript engines for desktop browsers. If you consider users with handheld devices that have functionality similar to PCs (and even take media="screen" instead of media="handheld" for stylin

[jQuery] Re: Question about Event Handling Optimization

2008-06-27 Thread Ambient.Impact
While I can't answer your question, if no else can, here's a method I use when building a website: I give each page a unique ID on the element. This is generated by a PHP script, but you could do it manually as well. Then I use a switch statement in my main JavaScript file, testing for $ ('body'