Tips for writing better Javascript using jQuery
Upcoming SlideShare
Loading in...5
×
 

Tips for writing better Javascript using jQuery

on

  • 5,084 views

 

Statistics

Views

Total Views
5,084
Views on SlideShare
3,456
Embed Views
1,628

Actions

Likes
5
Downloads
20
Comments
0

15 Embeds 1,628

http://wpmu.org 1424
https://twitter.com 119
http://storify.com 36
http://premium.wpmudev.org 17
http://feeds.feedburner.com 8
http://wordpressplugins.collected.info 7
http://blog.verha.net 4
http://www.newsblur.com 3
https://si0.twimg.com 2
http://www.mefeedia.com 2
http://127.0.0.1 2
http://twitter.com 1
http://instacurate.com 1
http://translate.googleusercontent.com 1
http://www.hanrss.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Tips for writing better Javascript using jQuery Tips for writing better Javascript using jQuery Presentation Transcript

  • Mistakes I made using jQuery, and how to avoid them Andy Peatling apeatling.com @apeatlingSaturday, 13 October, 12
  • Mistakes I made using jQuery, and how to avoid them Tips for writing better Javascript using jQuerySaturday, 13 October, 12
  • Hi, I’m Andy I work for Automattic I work on WordPress.comSaturday, 13 October, 12 View slide
  • I used to live in Vancouver...Saturday, 13 October, 12 View slide
  • ...now I live in Winnipeg.Saturday, 13 October, 12
  • Saturday, 13 October, 12
  • jQuery + WordPress Selectors Events AJAX + StateSaturday, 13 October, 12
  • Javascript !== jQuery javascriptenlightenment.comSaturday, 13 October, 12
  • jQuery + WordPressSaturday, 13 October, 12
  • Use the version of jQuery bundled with WordPress core. jQuery + WordPress: 1/3Saturday, 13 October, 12
  • Don’t assume you can use $() without conflict. jQuery + WordPress: 2/3Saturday, 13 October, 12
  • Don’t assume you can use $() without conflict. jQuery + WordPress: 2/3Saturday, 13 October, 12
  • Don’t assume you can use $() without conflict. jQuery + WordPress: 2/3Saturday, 13 October, 12
  • Namespace your events! Don’t be heavy handed in your plugins (or theme). jQuery + WordPress: 3/3Saturday, 13 October, 12
  • Namespace your events! Don’t be heavy handed in your plugins (or theme). jQuery + WordPress: 3/3Saturday, 13 October, 12
  • SelectorsSaturday, 13 October, 12
  • Cache your selectors for extra speed! Selectors: 1/4Saturday, 13 October, 12
  • Cache your selectors for extra speed! 60-70% faster! Selectors: 1/4Saturday, 13 October, 12
  • Use chaining where it makes sense. Selectors: 2/4Saturday, 13 October, 12
  • Use chaining where it makes sense. Selectors: 2/4Saturday, 13 October, 12
  • Be aware of the jQuery stack Selectors: 3/4Saturday, 13 October, 12
  • Be aware of the jQuery stack Ref: http://bit.ly/PW2hpu Selectors: 3/4Saturday, 13 October, 12
  • Use context in your selectors. Selectors: 4/4Saturday, 13 October, 12
  • Use context in your selectors. 15-20% faster! Selectors: 4/4Saturday, 13 October, 12
  • Use context in your selectors. Even faster! Selectors: 4/4Saturday, 13 October, 12
  • EventsSaturday, 13 October, 12
  • Use .on() Events: 1/3Saturday, 13 October, 12
  • Use .on() Events: 1/3Saturday, 13 October, 12
  • Use .on() Events: 1/3Saturday, 13 October, 12
  • Use .on() Events: 1/3Saturday, 13 October, 12
  • Oh, and make sure you’re delegating. Events: 2/3Saturday, 13 October, 12
  • Oh, and make sure you’re delegating. Event bound to one element, not potentially hundreds of elements... faster! Events: 2/3Saturday, 13 October, 12
  • Custom Events are awesome! Ref: http://bit.ly/PW2hpu Events: 3/3Saturday, 13 October, 12
  • Custom Events are awesome! Events: 3/3Saturday, 13 October, 12
  • Custom Events are awesome! Ref: http://bit.ly/PW2hpu Events: 3/3Saturday, 13 October, 12
  • Custom Events are awesome! Ref: http://bit.ly/PW2hpuSaturday, 13 October, 12
  • AJAX + StateSaturday, 13 October, 12
  • Make use of HTML 5 data attributesSaturday, 13 October, 12
  • Make use of HTML 5 data attributes AJAX + State: 1/3Saturday, 13 October, 12
  • Don’t get caught out by the A in AJAX.Saturday, 13 October, 12
  • Don’t get caught out by the A in AJAX. AJAX + State: 2/3Saturday, 13 October, 12
  • Use $.Deferred() when state gets more complex. AJAX + State: 3/3Saturday, 13 October, 12
  • What if we want the spinner to show for at least one second? AJAX + State: 3/3Saturday, 13 October, 12
  • We could manage our own state... AJAX + State: 3/3Saturday, 13 October, 12
  • We could manage our own state... AJAX + State: 3/3Saturday, 13 October, 12
  • We could manage our own state... AJAX + State: 3/3Saturday, 13 October, 12
  • Avoid the duplication, use $.Deferred() AJAX + State: 3/3Saturday, 13 October, 12
  • Avoid the duplication, use $.Deferred() AJAX + State: 3/3Saturday, 13 October, 12
  • http://api.jquery.com/category/deferred-object/Saturday, 13 October, 12
  • Thanks! Andy Peatling apeatling.com @apeatlingSaturday, 13 October, 12