Re:Don’t let jQuery’s $(document).ready() slow you down
by JustinSeriously on Thursday August 19, 2010 @01:28PM
(#1617949)
On the other hand, if a dev is that unfamiliar with jQuery code, they shouldn't maintaining jQuery code.
Using $(function(){}); serves as a nice warning to this effect.
Re:Don’t let jQuery’s $(document).ready() slow you down
by rue on Thursday August 19, 2010 @08:05PM
(#1619077)
That is an awful argument. Can you imagine what software would look like if people took that approach with everything? Development would have ground to a halt decades ago.
Re:Don’t let jQuery’s $(document).ready() slow you down
by ganjianwei on Friday October 01, 2010 @01:27PM
(#1747785)
I think the point is that they should learn enough jQuery before maintaining jQuery code.
Re:Don’t let jQuery’s $(document).ready() slow you down
by IgorPartola on Thursday August 19, 2010 @11:29AM
(#1617627)
Or even better:
jQuery(document).ready(function($){});
Re:Don’t let jQuery’s $(document).ready() slow you down
by Encosia on Thursday August 19, 2010 @11:54AM
(#1617697)
You can also use the module pattern[1] to isolate code from tampering or conflicts:
(function($, window, undefined) {
$(document).ready({
// etc.
});
}(jQuery, window);
[1] http://www.yuiblog.com/blog/2007/06/12/module-pattern/
jQuery(document).ready(function(){});