john resig post icon jquery library design

One of my upcoming web projects uses the AJAX technology and jQuery. I had watched a dozen of video lectures on JavaScript before and thought that I have seen them all. Today I came across John Resig's website and found that he just had been at Google and gave a video lecture on Best Practices in JavaScript Library Design.

John Resig is a JavaScript Evangelist, working for the Mozilla Corporation, and the author of the book 'Pro JavaScript Techniques.' He's also the creator and lead developer of the jQuery JavaScript library and the co-designer of the FUEL JavaScript library (included in Firefox 3).

This talk explores all the techniques used to build a robust, reusable, cross-platform JavaScript Library. We'll look at how to write a solid JavaScript API, show you how to use functional programming to create contained, concise, code, and delve deep into common cross browser issues that you'll have to solve in order to have a successful library.

Here is the video:

And here are the slides:

Things that caught my attention in video:

  • (01:49) jQuery was released on Jan. 2006 and it's main focus is on DOM traversal.
  • (05:39) Similar objects should have the same method and property names so there was minimal learning curve.
  • (07:16) Fear adding methods to the API. You should keep the API as small as possible.
  • (11:38) jQuery 1.1 removed reduced size by 47% by removing unnecessary methods, breaking compatibility with jQuery 1.0. A plugin for 1.1 was released as a separate package to provide the old 1.0 interface.
  • (14:10) Look for common patterns in the API and reduce it to its code.
  • (15:33) Be consistent within your API, stick to a naming scheme and argument positioning.
  • (17:11) Evolution of a JavaScript coder:
    • Everything is a reference!
    • You can do OO code!
    • Huh, so that's how Object Prototypes work!
    • Thank God for closures!
  • (21:20) In JavaScript 1.7 there is a let statement which declares variables local to a block.
  • (22:43) If you wrap your entire library in (function() { ... library code ... })() the code will never mess other library code.
  • (24:10) Some namespacing questions:
    • (24:17) Can my code coexist with other random code on the site?
    • (24:50) Can my code coexist with other copies of my own library?
    • (25:16) Can my code be embedded inside another namespace?
  • (25:42) Never extend native objects, ever!
  • (26:39) A JavaScript library should: first, work cross browser; second, have functionality.
  • (32:09) You can tweak your Object constructor to make Constructor() work the same as new Constructor().
  • (34:37) There are three ways to extend jQuery, you can add methods, selectors and animations.
  • (36:37) Message passing from one component to another is best done via custom events.
  • (37:45) Quirksmode is a fantastic resource which explains where specific bugs exist in the browsers.
  • (38:53) DOM Events and DOM Traversal problems are solved in depth, many others, such as getting an attribute and getting the computer style still require hard work.
  • (41:09) In Safari 2 the getComputedStyle is null if it's called on an element with display: none or on an element which is within an element with display: none. Safari 3 implemented the interface but they just return undefined.
  • (45:08) Use structured format for documentation. What's nice about it is that it can be converted to other formats and given to users.
  • (48:16) Let your users help you by putting out documentation in a Wiki.
  • (49:36) Don't trust any library that doesn't have a test suite.

Here is the QA:

  • (52:40) Is jQuery more or less targeted on FireFox and wouldn't actually be reasonable to use, say, on a cellphone?
  • (53:29) How do you filter noise in community?
  • (54:30) Is jQuery going to get multiple build sets?
  • (55:05) Will there ever be time when library development like this is not necessary anymore? Or do you think that the ecosystem of libraries is good for advancing state of the art?
  • (56:34) How do you compare jQuery to something like Google Web Toolkit
  • (57:12) What's the largest project jQuery is used in, in terms of size and development team, and code base.

Have fun learning better JavaScript!

Comments

January 30, 2009, 11:32

www.catonmat.net - cooooolest domain name)))

August 12, 2014, 14:40

I really love your blog.I wanted to thank you for this great read!! I definitely enjoying each and every little bit of the article and I have you bookmarked your site to check out new stuff you post.

independence day images
happy independence day images.

FIBA Permalink
August 22, 2014, 13:05

I really love your blog.I wanted to thank you for this great read!! I definitely enjoying each and every little bit of the article and I have you bookmarked your site to check out new stuff you post.

fiba 2014
fiba world cup
fiba world cup 2014
Basketball world cup 2014
fiba world cup schedule
fiba world cup 2014 teams
fiba world cup 2014 groups
fiba live streaming,

October 11, 2014, 07:34

The tips which you have shared in this post are just awesome. These tips are really helpful to me and I think it should must helpful to others. I really like the style of writing this article. Your articles are always helps me a lot. Thanks for sharing this wonderful article with us.

Diwali 2014
Diwali Wishes
Diwali images
Diwali SMS
Diwali Rangoli
Diwali messages
Diwali Greetings
Diwali poems
Diwali Quotes
Happy Diwali
Happy Diwali 2014
Happy Diwali Wishes.
Diwali 2014
Diwali Wishes
Diwali images
Happy Diwali SMS
Happy Diwali Rangoli
Happy Diwali messages
Happy Diwali Greetings
Happy Diwali poems
Happy Diwali Quotes
Only Whatsapp.

October 29, 2014, 03:53

Center of M88 match at Old Trafford between Manchester United and Chelsea have a dramatic ending. Play no better opponent, but Chelsea are the team opened the scoring before Drogba's free. So the Blues 'lead was maintained until injury time, but right on time for overtime last stone Persie equalized for the Reds flock (94').
After the match, Mourinho has reason to complain about the work of the referee M88
. The first is the situation Smalling pulled Ivanovic falls in the penalty area after 36 minutes, pretty obviously, but there was no whistle, no rapture. By the end of the match, before Persie 138 bet |
bodog88 |
188bet |
dafabet |
fun88 |
166bet |
m88 |

equalized, Ivanovic had received 2nd yellow card for a foul on Di Maria due (M88 kick then resulted in a goal) and "special" that it was decided to have heavy-handed part.

fake hermes Throughout replica hermes birkinthe cattle along with the hermes replica outletfoot ended up tied up for the twigs along with foliage, along with needed your cattle go lower, mix replica chanel bagsup your cattle walk along with circumstances. Hermes bar-b-que a pair of nearly all extra fat cattle, broken down straight into 12 identical pieces, on the Olympus huge batch gods (an even dozen Olympians), additionally, they take one {fake omega watches}particular.

July 16, 2014, 05:50

Following Losangeles, New York and Hongkong, recently, Christian Louboutin at a private house in the western suburbs of Shanghai held a special hublot replica private garden luncheon and announced the Passage handbags series released in mainland China. And invited photographer Chen Man, supermodel designer Lv Yan, supermodel, Wang Zhuxiaoyin, famous artist chanel replica Pei Bei couple weeks in Shanghai, as well as celebrity Yuesai replica watches lady, Mrs. Yaqi attended. Against the flowers and Passage series of handbags, they spent a happy afternoon.

May 23, 2014, 07:15
May 23, 2014, 07:15
May 23, 2014, 07:15
May 23, 2014, 07:15
June 04, 2014, 11:53

well done superb coding

June 13, 2014, 01:50

It is good to apply javascript for design like this suggestion. This will be a great suggestion.

faheen Permalink
June 22, 2014, 04:46

Ramadan Wallpaper
Ramadan Wallpaper HD Download
Ramadan Wallpaper 2014
Ramadan Wallpaper 2014 Download
Ramadan Wallpaper 2014 HD Images
Ramadan Wallpaper 2014 Images
Ramadan Wallpaper quotes
Ramadan wallpaper greetings
Ramadan wallpaper 2014 greetings
Ramadan Wallpaper 2014 quotes
Ramadan Kareem 2014 images
Ramadan Kareem Mubarak Images
Ramadan Kareem Mubarak 2014 images
Ramadan Screen Saver 2014 download
Ramadan Mubarak images
Ramadan images 2014
Ramadan Mubarak greetings
Wish you happy Ramadan 2014
Happy Ramadan Wallpaper 2014
Ramadan wallpaper 2014
Wish you happy Ramadan 2014
ramadan Hd wallpaper 2014
Wish you happy Ramadan wallpaper 2014
Ramadan 2014 images
Ramadan 2014 pictures
wish you happy Ramadan 2014 images
Wish you happy Ramadan 2014 pictures
Happy ramadan 2014 wallpaper
Ramadan Kareem 2014 Wallpaper
Ramadan Mubarak 2014 wallpaper
Wallpaper Ramadan 2014
Ramadan HD wallpaper
Ramadan 2014 HD wallpaper
wish you Ramadan 2014 HD wallpaper
Happy Ramadan HD wallpaper
Happy Ramadan 2014 HD wallpaper
Wish you Ramadan HD wallpaper Download 2014
Ramadan HD wallpaper Download 2014
Ramadan HD wallpaper 2014 Download
Ramadan HD wallpaper 1080p
Ramadan 2014 HD wallpaper 1080p
Best Ramadan 2014 HD wallpaper
Top 10 Ramadan 2014 HD wallpaper
Best Collections Of Ramadan 2014 HD wallpaper
Ramadan 2014 HD wallpaper For Android
Ramadan 2014 best Screensaver download
Ramadan 2014 Screensaver download
screensaver download for mobile Ramadan 2014
Ramadan 2014 HD Screensaver Download
Ramadan 2014 download best screen saver
Screensaver for 2014 ramadan
Ramadan mubarak screensaver download
Ramadan mubarak 2014 best screen saver
Ramadan Kareem Mubarak 2014 best screen saver
Ramadan mubarak 2014 best screen saver
screen saver 2014 download free for android
Ramadan Kareem Mubarak Greetings 2014
Best Collections of Ramadan 2014 Greetings
Best Collections of Ramadan 2014 Greetings
Top Collections of Ramadan 2014 Greetings
Ramadan 2014 Greetings
Ramadan 2014 Greetings Free
Ramadan 2014 Greetings Kareem best
Best Collections of Ramadan 2014 Kareem Greetings
Best Collections of Ramadan 2014 Kareem Greetings
Best Collections of Ramadan 2014 kareem greetings
Top Ramadan 2014 wallpapers
Top Ramadan 2014 pictures
Top ramadan 2014 pictures for pc
Top ramadan 2014 Wallpaper for Android
Ramadan 2014 best softwares
Ramadan 2014 Best Images of Desktop
Ramadan 2014 best pictures for desktop
ramadan 2014 collection of Hd wallpaper
Ramadan 2014 Best collections
Ramadan 2014 top Hd wallpaper
Ramadan 2014 in uk
When Ramadan 2014 in Uk
ramadan 2014 in United Kingdom
When Ramadan 2014 in United States
When ramadan 2014 in America
Ramadan date in uk
Ramadan date in uk
Ramadan facts in united kingdom
Ramadan date in France
Ramadan 2014 in france
Ramadan 2014 date in france
Ramadan 2014 date in Frace country
Happy Ramadan 2014 best wallpaper
Ramadan Wallpaper best collections
Ramadan Kareem Wallpaper collections
wish you happy Ramadan wallpaper 2014
happy Ramadan wallpaper 2014
wish you happy Ramadan Hd wallpaper
Happy Ramadan 2014 HD wallpaper
Hd Ramadan wallpaper 2014
Wallpaper 2014 Hd in Ramadan
Ramadan wallpaper 2014 for Desktop Background
Best Islamic Ramadan wallpaper 2014
Wallpaper 2014 for facebook Cover
Best Wallpaper 2014 Download
Ramadan HD wallpaper 2014 Download
When ramadan in India 2014
Ramadan in India 2014
Ramadan in India 2014
Ramadan Kareem Greetings
Ramadan kareem Mubarak Greetings
Ramadan kareeem 2014 Greetings
Ramadan 2014 kareem Greetings
Ramadan 2014 kareem greetings
Ramadan Kareem Mubarak 2014
Ramadan kareem Mubarak 2014
Ramadan kareem Mubarak 2014
Ramadan Kareem greetings 2014
Ramadan Kareem greetings 2014
Ramadan Kareem greetings 2014
Ramadan Kareem greetings 2014
Ramadan Kareem greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Awesome Post Ramadan Wallpaper Ramadan Wallpaper HD Download Ramadan Wallpaper 2014 Ramadan Wallpaper 2014 Download Ramadan Wallpaper 2014 HD Images Ramadan Wallpaper 2014 Images Ramadan Wallpaper quotes Ramadan wallpaper greetings Ramadan wallpaper 2014 greetings Ramadan Wallpaper 2014 quotes Ramadan Kareem 2014 images Ramadan Kareem Mubarak Images Ramadan Kareem Mubarak 2014 images Ramadan Screen Saver 2014 download Ramadan Mubarak images Ramadan images 2014 Ramadan Mubarak greetings Wish you happy Ramadan 2014 Happy Ramadan Wallpaper 2014 Ramadan wallpaper 2014 Wish you happy Ramadan 2014 ramadan Hd wallpaper 2014 Wish you happy Ramadan wallpaper 2014 Ramadan 2014 images Ramadan 2014 pictures wish you happy Ramadan 2014 images Wish you happy Ramadan 2014 pictures Happy ramadan 2014 wallpaper Ramadan Kareem 2014 Wallpaper Ramadan Mubarak 2014 wallpaper Wallpaper Ramadan 2014 Ramadan HD wallpaper Ramadan 2014 HD wallpaper wish you Ramadan 2014 HD wallpaper Happy Ramadan HD wallpaper Happy Ramadan 2014 HD wallpaper Wish you Ramadan HD wallpaper Download 2014 Ramadan HD wallpaper Download 2014 Ramadan HD wallpaper 2014 Download Ramadan HD wallpaper 1080p Ramadan 2014 HD wallpaper 1080p Best Ramadan 2014 HD wallpaper Top 10 Ramadan 2014 HD wallpaper Best Collections Of Ramadan 2014 HD wallpaper Ramadan 2014 HD wallpaper For Android Ramadan 2014 best Screensaver download Ramadan 2014 Screensaver download screensaver download for mobile Ramadan 2014 Ramadan 2014 HD Screensaver Download Ramadan 2014 download best screen saver Screensaver for 2014 ramadan Ramadan mubarak screensaver download Ramadan mubarak 2014 best screen saver Ramadan Kareem Mubarak 2014 best screen saver Ramadan mubarak 2014 best screen saver screen saver 2014 download free for android Ramadan Kareem Mubarak Greetings 2014 Best Collections of Ramadan 2014 Greetings Best Collections of Ramadan 2014 Greetings Top Collections of Ramadan 2014 Greetings Ramadan 2014 Greetings Ramadan 2014 Greetings Free Ramadan 2014 Greetings Kareem best Best Collections of Ramadan 2014 Kareem Greetings Best Collections of Ramadan 2014 Kareem Greetings Best Collections of Ramadan 2014 kareem greetings Top Ramadan 2014 wallpapers Top Ramadan 2014 pictures Top ramadan 2014 pictures for pc Top ramadan 2014 Wallpaper for Android Ramadan 2014 best softwares Ramadan 2014 Best Images of Desktop Ramadan 2014 best pictures for desktop ramadan 2014 collection of Hd wallpaper Ramadan 2014 Best collections Ramadan 2014 top Hd wallpaper Ramadan 2014 in uk When Ramadan 2014 in Uk ramadan 2014 in United Kingdom When Ramadan 2014 in United States When ramadan 2014 in America Ramadan date in uk Ramadan date in uk Ramadan facts in united kingdom Ramadan date in France Ramadan 2014 in france Ramadan 2014 date in france Ramadan 2014 date in Frace country Happy Ramadan 2014 best wallpaper Ramadan Wallpaper best collections Ramadan Kareem Wallpaper collections wish you happy Ramadan wallpaper 2014 happy Ramadan wallpaper 2014 wish you happy Ramadan Hd wallpaper Happy Ramadan 2014 HD wallpaper Hd Ramadan wallpaper 2014 Wallpaper 2014 Hd in Ramadan Ramadan wallpaper 2014 for Desktop Background Best Islamic Ramadan wallpaper 2014 Wallpaper 2014 for facebook Cover Best Wallpaper 2014 Download Ramadan HD wallpaper 2014 Download When ramadan in India 2014 Ramadan in India 2014 Ramadan in India 2014 Ramadan Kareem Greetings Ramadan kareem Mubarak Greetings Ramadan kareeem 2014 Greetings Ramadan 2014 kareem Greetings Ramadan 2014 kareem greetings Ramadan Kareem Mubarak 2014 Ramadan kareem Mubarak 2014 Ramadan kareem Mubarak 2014 Ramadan Kareem greetings 2014 Ramadan Kareem greetings 2014 Ramadan Kareem greetings 2014 Ramadan Kareem greetings 2014 Ramadan Kareem greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics oHack Anna University Paper Valuation Anna University result 2014 Thanks for sharing

July 12, 2014, 09:18

Actually this post is about my personal interest and the mid of the post is truly informative and I love and elaboration quality of writer. I always try to find this type of info regarding this topic now here I got this thanks Happy Friendship Day SMSFriendship Day SMS independence day of india happy independence day images independence day wallpapers happy independence day sms again thanks for this great blog.

sanchit Permalink
July 25, 2014, 21:51

Hey its great post really enjoyed this one i found this on google ,i think there are still websmasters who provide quality contents to the reader and hope to come back soon and by the way Eid Mubarak Wishes
Eid Mubarak Sms in Hindi
Eid Mubarak sms In English
Eid Mubarak sms in Urdu
Eid Mubarak Wallpapers
Eid Mubarak Greetings
Eid Mubarak cardsto all of you also you can check Happy eid Mubarak 2014
really a great stuff

dfcgjo Permalink
July 28, 2014, 17:15

i am great admire of your articles
friendship day 2014
friendship day sms 2014
friendship day sms

thanks for awesome articles

dfcgjo Permalink
July 28, 2014, 17:15

i am great admire of your articles
friendship day 2014
friendship day sms 2014
friendship day sms

thanks for awesome articles

hana Permalink
August 04, 2014, 11:51

He must have spent a lot of time to obtain useful information. Sometimes do not get good information. A method of obtaining information from the Internet. Glad that I met with your site.
upvc پنجره - köpek maması - köpek cinsleri - عکس سگ - فروش سگ - خرید سگ - سگ
.

August 08, 2014, 12:54

Watch Bollywood hotest poonam pandey latest images. click here for all collection.

watch the exciting Hollywood Movies like inception which entertain you completly.

sanchit Permalink
August 13, 2014, 11:56

I am very happy to visit this site and hope to visit here again and again. I have bookmarked your site due to the interesting and relevant stuff found here. Also I have recommended the same to my other friends.
Independence day india
Happy Independence day India
Desh Bhakti songs
Patriotic songs
Whatsapp Status
Fb status
Independence Day Speech in English

Independence Day Quotes

Modi Speech on Independece Day 2014
PM Modi LIVE Speech on Independece Day 2014

This is my site, you can visit it and leave your valuable feedback.

August 21, 2014, 13:17
Rosy Permalink
August 30, 2014, 10:59

This article is quite helpful and informative too. I enjoyed a lot. Thanks for sharing such a great article.

Amazon Promotional Code 2014
Amazon Promotional Code
Amazon Promotional Code for August 2014

Thanks for sharing such a great article

October 03, 2014, 15:56

You have provided awesome stuff here. I'd say this will be loved by anyones who is doing Youtube marketing

Bakri Eid qurbani
Bakri Eid greeting cards 2014
Bakri Eid facebook status messages
Bakri Eid facebook cover photos
Significance of Bakri Eid 2014
Enjoy. Cheerss!!!

October 27, 2014, 06:33

Thanks for the post. Halloween 2014 Images

Keep up the good work.

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements