We currently use $.browser to check for IE6/7 oddities, but $.browser no longer exists in newer versions of jQuery. With IE6/7 usage below 1%, we should remove these checks.

In addition, we're using $.fn.attr frequently to get/set checkbox values, but this no longer works correctly in jQuery 1.6 and higher. We should use $.fn.prop when appropriate instead: http://api.jquery.com/prop

Comments

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new1.38 KB

Committed this to both branches.

  • Commit 876b49e on 6.x-1.x by quicksketch:
    Issue #2242787: Compatibility with jQuery 1.9+ (use of $.browser).
    
quicksketch’s picture

Status: Fixed » Needs work

Hmm, actually this problem is more widespread than I had thought. Besides the use of $.browser, we need to correctly use $.fn.prop (http://api.jquery.com/prop) for checking "disabled" and "checked" states. Unfortunately, $.fn.attr acts inconsistently between versions of jQuery, so we'll need some kind of check to use prop when possible and attr if not.

quicksketch’s picture

StatusFileSize
new5.53 KB

This patch conditionally switches between $.fn.prop if available and $.fn.attr otherwise. We did something similar in #1690202: Options textfields disabled on webform component (with jQuery Update), but it wasn't comprehensively used throughout the module. Note that only boolean properties like disabled and checked require this switch. The use of $.fn.attr on things like colspan and id are still valid.

I'm open to a prettier way of doing this, but since we use prop/attr so frequently, making a new jQuery method seemed like the most reasonable option to me.

quicksketch’s picture

Title: Compatibility with jQuery 1.9+ (use of $.browser) » Compatibility with jQuery 1.9+ (use of $.browser and $.fn.attr)
Issue summary: View changes
quicksketch’s picture

Status: Needs work » Fixed
StatusFileSize
new5.53 KB

Okay, committed this patch to both branches. I'll make a new release shortly.

Status: Fixed » Closed (fixed)

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