]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker: Don't use .delegate(). Fixes #7470 - Datepicker: 1.8.x can't be used...
authorScott González <scott.gonzalez@gmail.com>
Mon, 13 Jun 2011 12:46:57 +0000 (08:46 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 13 Jun 2011 12:46:57 +0000 (08:46 -0400)
ui/jquery.ui.datepicker.js

index 6681d693c71b7db8bfc8e2d97c77c5b33e140022..35c1fc11e7cf0206405c74c9564c70cb642e334e 100644 (file)
@@ -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');
                });
 }