[jQuery] Re: Interesting on document ready question

2009-01-01 Thread Ricardo Tomasi
Thanks. If only I could use something this simple for my graduation thesis :D That was mr. Firefox 3.0.5 on a C2D 1.6ghz. Firebug's timing is said not to be reliable, but I don't think there's much distortion in that. For a comparison, simply looping over the creation of 5000 functions takes mere

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Michael Geary
> > > > Why do I really need so much on ready? > > > Yes! That's what we're all wondering! Don't keep us > > > in suspense. :-) > > When you work with a bunch of morons in a company > > that uses them throughout the site and when the js are > > packaged will lead to unnecessary performance loss.

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Kean
5000 is just an exaggeration, it's probably in the realm of 20 On Dec 30, 10:42 pm, Kean wrote: > > >Why do I really need so much on ready? > > Yes! That's what we're all wondering! Don't keep us in suspense. :-) > > When you work with a bunch of morons in a company that uses them > throughout t

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Kean
> >Why do I really need so much on ready? > Yes! That's what we're all wondering! Don't keep us in suspense. :-) When you work with a bunch of morons in a company that uses them throughout the site and when the js are packaged will lead to unnecessary performance loss.

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Michael Geary
> From: Kean > > No, I don't take that as an insult. I was worried needlessly, then. :-) > I was just wondering how document ready was coded so it > really was just a hypothetical question. Well, there is the source code. :-) http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js Just

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Michael Geary
Excellent analysis, Ricardo. BTW, which browser did you run your timing test in? Here's another tip. If you really do need to have thousands of ready functions, you can speed things up a bit by rolling your own. For example: window.ready = []; jQuery(function() { for( var fn, i =

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Kean
Hi Ricardo, Sweet, that's what I was expecting for an answer.

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Ricardo Tomasi
Hi Kean, AFAIK, ready() puts the function you passed into an array of functions. Another function is bound to the DOMContentLoaded event, which is fired when the DOM is ready on compliant browsers. For the others, several methods are in place to detect when DOM is loaded. When the event fires/DOM

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Kean
No, I don't take that as an insult. I was just wondering how document ready was coded so it really was just a hypothetical question. Why do I really need so much on ready? Also, MorningZ, I will be very active in the jQuery mailing list in future to learn more js. Perhaps this is not the best s

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread MorningZ
"There probably is a better way to do it. " Which is what i was getting at.. i hope "honest" isn't/wasn't taken as "insulting" On Dec 30, 10:16 pm, "Michael Geary" wrote: > Come on, MorningZ, there's no need for insults. > > But yes, 5000 of those will be pretty slow - and that's before

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread Michael Geary
Come on, MorningZ, there's no need for insults. But yes, 5000 of those will be pretty slow - and that's before you even execute the code inside those functions. How slow? It's easy to test. The ready functions are run in the order that the $() functions are called. So simply do this in a test pag

[jQuery] Re: Interesting on document ready question

2008-12-30 Thread MorningZ
If you've got 5000 of those, it's *seriously* time to reconsider your coding techniques. depending on that much JavaScript is just plain old stupid.. On Dec 30, 8:59 pm, Kean wrote: > Is document ready "actually" an event handler? > > Let's say I have > > $(function(){ > > }); > > $(f