permalink

25

Spotlight on jQuery 1.5: jQuery.sub() Explained (Screencast)

Hey guys. This week the jQuery project released jQuery 1.5 which came with a number of interesting new features – one of the most significant ones was the concept of deferreds (or dfds for short) and the other was jQuery.sub(). Eric Hynds wrote a great article that explains deferreds in detail and today I’d like to explain .sub() in a short 10 minute screencast.

The basic idea behind jQuery.sub() is that it provides a relatively easy way to modify or override jQuery methods without affecting the original methods for others wishing to use them on the same page. It’s got a number of useful applications and in the screencast I’ll take you through some live examples that will (hopefully) explain them well, regardless of what level you’re at.

Watch the tutorial on how to use jQuery.sub() below (10 mins)

I recommend switching to HD mode and going fullscreen for the best viewing experience.

Watch the full-size jQuery.sub explained screencast from Addy Osmani on Vimeo

- The code used on jsFiddle.net: http://jsfiddle.net/g2txR/ 
- jQuery .sub() on the API site: http://api.jquery.com/jQuery.sub/
- YouTube 720p Mirror: http://www.youtube.com/watch?v=5RhZeMYssLc​
- Vid.ly SD Mirror: http://vid.ly/2q3x9o/​
- Blip.tv SD Mirror: http://blip.tv/file/4707329​

Thanks to vladikoff and coldhead for reviewing the screencast before it went live.

 

25 Comments

  1. Pingback: jQuery 1.5: jQuery.sub() Explained :DotNetInfos

  2. Pingback: Weekend Posts & Videos For jQuery Developers (4/1/2011)

  3. Pingback: Link-urile săptămânii 1-6 Feb 2011 « Staicu Ionuţ-Bogdan - the Frontend Developer Staicu Ionuţ-Bogdan – the Frontend Developer

  4. Pingback: jQuery: » jQuery Community Updates For February 2011

  5. Pingback: New Releases, Videos & A Sneak Peek At The jQuery UI Grid | Webdevelopment Resources

  6. Cheers Addy, you provide a good explanation for this new feature! I've never seen one of your screen-casts before… loved the intro lol!

    As for the usefulness of jQuery.sub() I've written two examples as a gist. One using jQuery.sub() and one without, showing how you can add methods to your plugins instance only. My current opinion is that it appears simpler not to use jQuery.sub().

    I'm pretty sure I must be missing something and would appreciate any input you might have. Check out this gist: https://gist.github.com/827617

  7. Pingback: New Releases, Videos & A Sneak Peek At The jQuery UI Grid

  8. Pingback: New Releases, Videos & A Sneak Peek At The jQuery UI Grid | Scripting4You Blog

  9. I agree the tutorial and I learned how to use it and Is that it provides a relatively easy way to modify or override jQuery methods without affecting the original methods for others.
    Thank you,,

  10. I’m really loving the theme/design of your weblog. Do you ever run into any browser compatibility problems? A number of my blog readers have complained about my website not operating correctly in Explorer but looks great in Opera. Do you have any suggestions to help fix this issue?

Leave a Reply

Required fields are marked *.