diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-06-13 08:46:57 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-06-13 08:46:57 -0400 |
commit | 4d8529cf8406a3feecbe30d57c2ceb366ec71eb4 (patch) | |
tree | 084bcb159efe38c61c026197fc29b53e143411f5 | |
parent | d3ffacb75674a0c86d930299c69946646d3d6ba0 (diff) | |
download | jquery-ui-4d8529cf8406a3feecbe30d57c2ceb366ec71eb4.tar.gz jquery-ui-4d8529cf8406a3feecbe30d57c2ceb366ec71eb4.zip |
Datepicker: Don't use .delegate(). Fixes #7470 - Datepicker: 1.8.x can't be used with jQuery 1.3.2 due to use of .delegate().
-rw-r--r-- | ui/jquery.ui.datepicker.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 6681d693c..35c1fc11e 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -1727,18 +1727,23 @@ $.extend(Datepicker.prototype, { */ function bindHover(dpDiv) { var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; - return dpDiv.delegate(selector, 'mouseout', function() { - $(this).removeClass('ui-state-hover'); - if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); - if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); + return dpDiv.bind('mouseout', function(event) { + var elem = $( event.target ).closest( selector ); + if ( !elem.length ) { + return; + } + elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" ); }) - .delegate(selector, 'mouseover', function(){ - if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) { - $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); - $(this).addClass('ui-state-hover'); - if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); - if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); + .bind('mouseover', function(event) { + var elem = $( event.target ).closest( selector ); + if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) || + !elem.length ) { + return; } + elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); + elem.addClass('ui-state-hover'); + if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover'); + if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover'); }); } |