Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291172

states.js is not compatible with jquery +1.6.1 because it use $.attr in the wrong way

$
0
0

In the same spirite than #1480568: use $.attr with false instead of empty string I would like to fix states.js to make it compatible with jQuery we have in core *and* more recent version.

I'm explaining the problem with new jquery version in #1498858: [meta] attr and prop.

The corresponding issue on jQuery Update #1448490: fix states.js upstream and remove the overwrite in jQuery Update.

From my first reading of the code I think the problem is in

states.Trigger.states = {
  // 'empty' describes the state to be monitored
  empty: {
    // 'keyup' is the (native DOM) event that we watch for.
    'keyup': function () {
      // The function associated to that trigger returns the new value for the
      // state.
      return this.val() == '';
    }
  },

  checked: {
    'change': function () {
      return this.attr('checked');
    }
  },

checked.change can certainly return undefined. So we need to return false if we have anythings but true.

So somethings like that (untested)

checked: {
    'change': function () {
      if(this.attr('checked') === true){
       return true;
      }else {
       return false;
     }
    }
  },

Viewing all articles
Browse latest Browse all 291172

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>