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().

This commit is contained in:
Scott González 2011-06-13 08:46:57 -04:00
parent d3ffacb756
commit 4d8529cf84

View 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');
})
.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');
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" );
})
.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');
});
}