News for hackers. Stuff that matters.
Re:JQuery 1.6 released by jeresig on Tuesday May 03, 2011 @11:41AM (#2510391)
Which changes (I assume, to .attr()) are affecting you, in particular?
Re:JQuery 1.6 released by troyk on Tuesday May 03, 2011 @11:56AM (#2510482)
Yes, I've since read other comments and have a better understanding of the reasoning behind .attr and .prop, so I'm a little less bah-humbug about having to refactor before upgrading. It appears that search/replace .attr('value') => .val(), .attr('checked') => .prop('checked') are the big offenders, but probably need to look closer at .attr('enabled') and .attr('disabled') as well.
Re:JQuery 1.6 released by crescentfresh on Tuesday May 03, 2011 @12:26PM (#2510623)
Relying on the following attributes as returned from .attr() will break, and should get ported to use .prop() instead: 'checked', 'disabled', 'readonly', 'selected' (for <option>s), 'multiple' (for <select>s), 'ismap' (for <img>s), 'defer', 'noresize' (for <frame>s), 'nowrap'.

List compiled (partially) from http://stackoverflow.com/questions/706384/boolean-html-attri...

Re:JQuery 1.6 released by pak on Tuesday May 03, 2011 @12:57PM (#2510747)
This should be linked to or listed directly in the OP.

Really, most people reading the changelog care about "how do I make my existing code work with this"--and the details listed are conceptual, but not all practically relevant.

Re:JQuery 1.6 released by ars on Tuesday May 03, 2011 @05:27PM (#2511733)
I have this code:

  $.fn.setAttr = function(attr, bool) {
    if(bool)
      this.attr(attr, attr);
    else
      this.removeAttr(attr);

    return this;
  }

  $.fn.disabled = function(bool) {
    return this.setAttr('disabled', bool);
  }

  $.fn.checked = function(bool) {
    return this.setAttr('checked', bool);
  }
I assume I should change all attr to prop?

I think you should add two more helpers (like .val):

.checked() and .disabled() - with no parameters they return a boolean, and with a parameter you can pass in true/false to set the property.

Those two are probably the most commonly used properties and if you had them most people could probably ignore attr vs prop.

Re:JQuery 1.6 released by dmethvin on Tuesday May 03, 2011 @08:39PM (#2512325)
The blog entry mentions this, but perhaps without enough detail. Your `.setAttr()` exactly matches the same as the `.attr()` method's new behavior when it's passed a Boolean argument to set. The other two would be great suggestions for 1.7!