A jQuery 1.3 quirk that bit me

deviantART just upgraded to jQuery 1.3, and we found an undocumented jQuery change that broke some things.

The behavior of the :enabled selector changed. Before it selected all enabled form elements, now it selects all enabled and non-hidden form elements. This bit us, because we were using jQuery to assemble some form elements to submit over xmlhttprequest… and now some hidden fields weren’t getting included.

This means that if you were using :enabled, you now need to use :not(:disabled) to get the old behavior.

A bit of googling turned up that this is a deliberate change, to match the behavior of querySelectorAll in browsers that have implemented it. I’d disagree with the phrasing John Resig used, “more standards compliant”, since “enabled” has a specific meaning in the standards.

This should really have been in the release notes

Join the Conversation

1 Comment

  1. David,

    I wanted to email you about your map highlight plugin and how it breaks in IE8 due to change in how you can add stylsheet rule in IE8. I found about this problem through a stackoverflow question. I debugged through the source and created a fix. I thought you may like to incorporate the patch so that your plugin works correctly in IE8.

    Complete discussion of the bug and the relevant patch can be found here:

    http://stackoverflow.com/quest

    Thanks!
    Yogi

Leave a comment

Your email address will not be published. Required fields are marked *