aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkborchers <k_borchers@yahoo.com>2011-09-12 13:30:41 -0500
committerkborchers <k_borchers@yahoo.com>2011-09-12 13:30:41 -0500
commitaf76ad1c82625521b94bfc8bf967d9ca4f44da37 (patch)
tree2b159505000965cc512e35aec2f96c6ca8c1ce09
parent96c2c8e639abc1894cdb1588982219f31634a164 (diff)
downloadjquery-ui-af76ad1c82625521b94bfc8bf967d9ca4f44da37.tar.gz
jquery-ui-af76ad1c82625521b94bfc8bf967d9ca4f44da37.zip
Datepicker: Added additional check to checkExternalClick to work when clicking in another datepicker and removed old fix. Fixes #7686 - infinite loop when onclose event shows a second calendar
-rw-r--r--ui/jquery.ui.datepicker.js29
1 files changed, 14 insertions, 15 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 0b6fb2218..e09dc5a50 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -636,10 +636,10 @@ $.extend(Datepicker.prototype, {
return;
var inst = $.datepicker._getInst(input);
if ($.datepicker._curInst && $.datepicker._curInst != inst) {
- if ( $.datepicker._datepickerShowing ) {
- $.datepicker._triggerOnClose($.datepicker._curInst);
- }
$.datepicker._curInst.dpDiv.stop(true, true);
+ if ( inst && $.datepicker._datepickerShowing ) {
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
+ }
}
var beforeShow = $.datepicker._get(inst, 'beforeShow');
var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
@@ -790,14 +790,6 @@ $.extend(Datepicker.prototype, {
return [position.left, position.top];
},
- /* Trigger custom callback of onClose. */
- _triggerOnClose: function(inst) {
- var onClose = this._get(inst, 'onClose');
- if (onClose)
- onClose.apply((inst.input ? inst.input[0] : null),
- [(inst.input ? inst.input.val() : ''), inst]);
- },
-
/* Hide the date picker from view.
@param input element - the input field attached to the date picker */
_hideDatepicker: function(input) {
@@ -820,8 +812,11 @@ $.extend(Datepicker.prototype, {
(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
if (!showAnim)
postProcess();
- $.datepicker._triggerOnClose(inst);
this._datepickerShowing = false;
+ var onClose = this._get(inst, 'onClose');
+ if (onClose)
+ onClose.apply((inst.input ? inst.input[0] : null),
+ [(inst.input ? inst.input.val() : ''), inst]);
this._lastInput = null;
if (this._inDialog) {
this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
@@ -843,12 +838,16 @@ $.extend(Datepicker.prototype, {
_checkExternalClick: function(event) {
if (!$.datepicker._curInst)
return;
- var $target = $(event.target);
- if ($target[0].id != $.datepicker._mainDivId &&
+
+ var $target = $(event.target),
+ inst = $.datepicker._getInst($target[0]);
+
+ if ( ( ( $target[0].id != $.datepicker._mainDivId &&
$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.hasClass($.datepicker._triggerClass) &&
- $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
$.datepicker._hideDatepicker();
},