Hacker News new | past | comments | ask | show | jobs | submit login

Which changes (I assume, to .attr()) are affecting you, in particular?

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.

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...

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.

I have this code:

  $.fn.setAttr = function(attr, bool) {
      this.attr(attr, 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.

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!

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact