ruzz' stream of semi-consciousness http://stream.ruzz.org when you give up caring, you give up.. caring. posterous.com Sat, 16 Oct 2010 09:06:00 -0700 jQuery 1.4.3 is out, here's why i care http://stream.ruzz.org/jquery-143-is-out-heres-why-i-care-4 http://stream.ruzz.org/jquery-143-is-out-heres-why-i-care-4

another "minor" release in the 1.4.x line -- read the blog for more details: http://blog.jquery.com/2010/10/16/jquery-143-released/

it's got some cool stuff in it, and shows to me that the jQuery team has their shit together in a huge way. They call a release like this minor, where a lot of development teams would consider that much work a substantial release. In any case, I don't normally bother to write about release updates, but there's something pretty juicy in this one relating indirectly to templating via a small change in the .data() methods. 

first imagine a template like:

<div id="user" data-id="1" data-name="John">
Hi  {{name}}
</div>

previously you had to monkey about doing things like var id = $('#user").attr('data-id'); to get that id and pass it to your templating engine. if you were passing several bits of data this could be tedious so you probably improved the above template to look like this:

<div id="user" data-user="{ id: '1', name:'john'}">
Hi  {{name}}
</div>

allowing you to pull all your attributes in one object, but you still had to manually pull your attributes all the time. 

enter 1.4.3 and all html 5 data attributes (you have been using the data-xxx format right?) are automagically read into the elements .data() object. this seems minor but is going to save a lot of tedious work because if the above template is used now you can just call $('#user').data('user'); and have access to all those values right out of the gate. 

sometimes small intuitive changes have the biggest impact. 

I can immediately go through some code on the app i'm working on and trim out a bunch of .attr() calls saving me code. but more interestingly anywhere i've already been using the html5 data tags (and i have) i already have access to those as data if i need them and this is key for me. It encourages the proper use of a new standard (html5) and rewards you for adopting it early with less work. We need more improvements in our tools along this line because it's the quickest way to get new standards to be "the" standard. 

when you couple changes like the above with speed improvements and implementation improvements (like becoming more compatible with CommonJS) and changes borne from your user bases expectations (Calling .data(Object) no longer completely replaces the data object instead it extends the existing object, leaving the unspecified values in place) you get a really great project to work with, even for minor releases. 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/597936/light_session_039.jpg http://posterous.com/users/5AqlMZNsWVSp i.m. ruzz ruzz i.m. ruzz