Many sites now use various means to update their version of jQuery to a later version than 1.4, the version in Drupal 7.

jQuery deprecated (version 1.6) and removed (version 1.9) the use of .attr() for use to set "checked" and "disabled" properties. It also points out that attempting to retrieve values by using .attr() will result in confusion/problems, as in this example: $elem.attr("checked"); will return true if $elem has a "checked" property at all, not if it is true.

jQuery now uses .prop() instead to set and retrieve the value of a "checked" or "disabled" properties of a node.

.removeAttr() may also cause problems/unexpected behavior, as it completely removes the property rather than setting it to false, consequently it will no longer be selectable by selectors that typically would work. 
Example: 
Using <code>jQuery('input[name="test"]').removeAttr('checked');

on <input name="test" type="checkbox" checked="true" /> will result in <input name="test" type="checkbox" />. This is typically not the intended result, as it will cause CSS and jQuery selectors that you would expect to be able to find that item to fail.
Example: jQuery('input[checked]') will now fail to return this node.

See: jQuery 1.9 Upgrade Guide: attr vs. prop

possible problems:

file: imagecache_actions/imagecache_actions.jquery.js

  1. Line 12: if (!$(":checkbox#edit-data-independent-corners-set-independent-corners").attr("checked")){
  2. Line 14: $(".form-item-data-radius input").attr("disabled", false);
  3. Line 16: $("#independent-corners-set input").attr("disabled", true);
  4. Line 20: $(".form-item-data-radius input").attr("disabled", true);
  5. Line 22: $("#independent-corners-set input").attr("disabled", false);

Comments

dman’s picture

Thanks for the heads-up.

Thanks for identifying the specific examples also
This only applies to a admin UI form enhancement on rounded-corners
- which I think does a job some-of-which would be better handled by form #states rules anyway nowadays?

Should be an easy tidy-up if anyone feels like looking at a patch.

dman’s picture

Issue #2416805 - remove deprecated jquery attr() and replace with FAPI #states (rounded corners UI form)

DrCord’s picture

@dman - Wow that was fast, you really are the man, the dman! Thanks for taking the initiative, this may be a good way to go about this in the many modules that have this problem...Thanks again! I will patch my version and we shall see.

  • dman committed 599e625 on 7.x-1.x
    Issue #2416805 - remove deprecated jquery attr() and replace with FAPI #...
dman’s picture

Status: Active » Fixed

This is safe, and has no blockers.
Committed into -dev

  • dman committed b328476 on 7.x-1.x
    [#2416805] Remove reference to non-existent imagecache_coloractions....
dman’s picture

Whoops. That issue number for the second commit was wrong. Should have been #2423553: imagecache_coloractions.install does not exist, but is defined in imagecache_coloractions.info
- I got messed up with drush-iq falling over for me.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.