开发者

jQuery Optimizations

开发者 https://www.devze.com 2022-12-23 04:24 出处:网络
I\'ve just come to the end of a large development project. We were on a tight timeline, so a lot o开发者_StackOverflowf optimization was \"deferred\". Now that we met our deadline, we\'re going back a

I've just come to the end of a large development project. We were on a tight timeline, so a lot o开发者_StackOverflowf optimization was "deferred". Now that we met our deadline, we're going back and trying to optimize things.

My questions is this: What are some of the most important things you look for when optimizing jQuery web sites. Alternately I'd love to hear of sites/lists that have particularly good advise for optimizing jQuery.

I've already read a few articles, http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx was an especially good read.


@aepheus, here is another site for reference: www.artzstudio.com/2009

Check out #8 on Eliminate Query waste. hth


mostly i look at selectors that repeat themselfs.. most of the times these can be saved into a variable and used over and over, for example:

$('.some_class').doSomthing();
$('.some_class').doSomethingElse();

can be turned into:

selectedItems = $('.some_class');
selectedItems.doSomething(); selectedItems.doSomethingElse();

this way the selector goes over the DOM once... then you can continue to use the variable as a jquery object thanks to the fact that every jquery method returns the jquery object.

Just one tip out of many out there...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号