JQuery 1.6.1 is coming with the fixes

In a couple of days JQuery team will release a new version of jquery (1.6.1), after the community struggled the problems of the backward compatibility in the last release (1.6) .. the new release redefine the usage and the effect of it on the DOM objects of both .attr() and .prop() ,
in this version the boolean attribute manipulation with .attr() will  back  as it was before the 1.6 release.
lets see an example:

<input id="mychkbox" type="checkbox" checked>

the result of the previous markup is a checked checkbox as we all know =d,
but thats the property value not the attribute value cuz the attribute “checked” is not set.

lets see the .attr() results in v.1.6:

alert($("#mychkbox").attr("checked")) // result >> ""
alert($("#mychkbox").prop("checked")) // true
alert(document.getElementById("mychkbox").checked") // true

thats because the attribute doesn’t change when the user change its state by clicking on it.,  thats fine.. but look at the following code

in the coming 1.6.1 release & prior versions than 1.6:

alert($("#mychkbox").attr("checked")) // true
alert($("#mychkbox").prop("checked")) // true (in 1.6.1 only)
alert(document.getElementById("mychkbox").checked") // true

in the coming release the behavior of .attr() will back as it was before 1.6 just because the sake of backward compatibility.

so it will work exactly as expected but that doesn’t mean you have to keep using attr() , switch to .prop() cuz it is more faster and oriented.

it might be confusing now what we should use for what when it comes to .prop() and .attr(), so here is the best usage as the Jquery team stated:
” The .prop() method should be used for boolean attributes/properties and for properties which do not exist in html (such as window.location).
All other attributes (ones you can see in the html) can and should continue to be manipulated with the .attr() method. ”

it is expected to see Jquery 1.6.1 at the end of this week, Also you can fill up the following proposal for new features to be landed in jquery 1.7.

ThankQ

Advertisements

About alaasdk

ASP.NET Developer, javascript geek and JQuery lover. IT Head at @acesegypt. Studying #Business and #Accounting in #Commerce school! #Cycling is my #1 transportation way. Living in a room in which you can't see walls from #Whiteboards.

Posted on May 11, 2011, in Jquery and tagged , , , . Bookmark the permalink. 5 Comments.

  1. Good. It’s fine to introduce new features, but considering the amount of plugins that would break, I think this is the right decision. This way we can refactor our code, and let plugin authors refactor theirs w/out rushing.

    On a side note, I like the content of your blog, but can I make a few suggestions. The font of the post is not super readable, I would adjust that. You may also want to check your posts for grammar/spelling/punctuation. But other than that, this post is going in my “development” Google Reader folder.

    • thanks for your feedback, I appreciate it 🙂 .. I’ll try to change the font in the coming posts, for the grammar I think it will be better by time.

  2. Hey, just stumbled on this site from reddit. It is not blog post I would normally read, but I loved your perspective on it. Thanx for creating an article worth reading!

  3. We need freelance desperately. After reviewing this site, we really want you on our workforce. We pay out $35-$50 per hour. Our top people are pulling in over $91K a YEAR, writing part time.
    Please swing by and see us. http://write.ncsall.org

  1. Pingback: Passage de jQuery 1.5.x vers jQuery 1.6 | LudiBlog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: