aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.datepicker.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.datepicker.js')
-rw-r--r--ui/jquery.ui.datepicker.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 976534c94..b433cb79b 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -774,9 +774,10 @@ $.extend(Datepicker.prototype, {
inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
}
- if (inst.input.is(":visible") && !inst.input.is(":disabled")) {
+ if ( $.datepicker._shouldFocusInput( inst ) ) {
inst.input.focus();
}
+
$.datepicker._curInst = inst;
}
},
@@ -803,10 +804,7 @@ $.extend(Datepicker.prototype, {
inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
"Class"]("ui-datepicker-rtl");
- // #6694 - don't focus the input if it's already focused
- // this breaks the change event in IE
- if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
- inst.input.is(":visible") && !inst.input.is(":disabled") && inst.input[0] !== document.activeElement) {
+ if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
inst.input.focus();
}
@@ -823,6 +821,13 @@ $.extend(Datepicker.prototype, {
}
},
+ // #6694 - don't focus the input if it's already focused
+ // this breaks the change event in IE
+ // Support: IE and jQuery <1.9
+ _shouldFocusInput: function( inst ) {
+ return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
+ },
+
/* Check positioning to remain on screen. */
_checkOffset: function(inst, offset, isFixed) {
var dpWidth = inst.dpDiv.outerWidth(),