jQuery 1.4-1.6 Best new featuresPresentation Transcript
jQuery 1.4-1.6Best new features Ryan Blunden BrisJS MeetUp - May 2011
About me• Front End Dev Tech Lead at Flight Centre (FCL) from 2009 - 2011• FCL heavily relies on JS for interactivity and features. We maintain around 30 websites with15 Front-End Developers.• jQuery saves our bacon everyday• jQuery isn’t the car, it’s the toolbox to pimp the car.
jQuery 1.4 - Jan 2010 http://jquery14.com/day-01/jquery-14• API Standardisation for setter methods• Access “data-...” attributes via $.data• jQuery.type is awesome• Strict JSON parsing via Ajax if JSON available• jQuery.delegate() over jQuery.live()
jQuery 1.5 - Jan 2011http://blog.jquery.com/ http://blog.jquery.com/2011/01/31/jquery-15-released/• Ajax module rewritten, returns jQuery ajax instance• Ajax gets promises (deferred callbacks, nicer API)• Ajax “context” option (actually added in 1.4)• Clean way override/extend/modify jQuery with jQuery.sub
jQuery 1.6 - May 2011• That was quick... Because of breaking API changes• .attr() meets .prop(). Making jQuery act more like the underlying API.• Deferreds improve with .deferred.always() and deferred.pipe()• $.animate gets promises• .data when imports attributes based on W3C HTML5 spec (camelCase,)
jQuery news• jQuery mobile is in Alpha 4.1• “Ofﬁcial plugins” now means “maintained by Core jQuery team” (tmpl and data link plugins from Microsoft not ofﬁcial, tmpl not going into core)• Increased community contributions fuelling jQuery’s rapid development• Add your proposed change for jQuery 1.7 at http://goo.gl/spjIE
Summary• jQuery is a tool that allows easy and rapid development across the most common browsers• It can’t help you organise or structure your code, only you can do that. Good frameworks can help, greater knowledge can help more.• Current focus is on making it fast and improving API stability and consistency.• Look outside the jQuery plugin ecosystem for solutions that are beyond jQuery (underscoreJS)• Don’t write re-usable jQuery code that relies on $ being global. Pass jQuery into a self executing function surrounding your code.
Thanks• Any questions, please let me know• Twitter - @ryan_blunden