News for hackers. Stuff that matters.
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!