diff options
author | Keith Wood <kbwood.au@gmail.com> | 2009-03-22 05:47:08 +0000 |
---|---|---|
committer | Keith Wood <kbwood.au@gmail.com> | 2009-03-22 05:47:08 +0000 |
commit | 05a935c993d84100939465114f468a4427c99220 (patch) | |
tree | dd0ded333fec03beb4f73e3518faa42eb5ec97d0 /ui/ui.datepicker.js | |
parent | 219bccdeda984bbda2e885ef41cd873e56cf470e (diff) | |
download | jquery-ui-05a935c993d84100939465114f468a4427c99220.tar.gz jquery-ui-05a935c993d84100939465114f468a4427c99220.zip |
Fixed #4240 - Datepicker destroy affects other datepickers - appended text too
Diffstat (limited to 'ui/ui.datepicker.js')
-rw-r--r-- | ui/ui.datepicker.js | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js index 00f9f3cfc..947efc869 100644 --- a/ui/ui.datepicker.js +++ b/ui/ui.datepicker.js @@ -166,13 +166,16 @@ $.extend(Datepicker.prototype, { /* Attach the date picker to an input field. */ _connectDatepicker: function(target, inst) { var input = $(target); + inst.append = $([]); inst.trigger = $([]); if (input.hasClass(this.markerClassName)) return; var appendText = this._get(inst, 'appendText'); var isRTL = this._get(inst, 'isRTL'); - if (appendText) - input[isRTL ? 'before' : 'after']('<span class="' + this._appendClass + '">' + appendText + '</span>'); + if (appendText) { + inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>'); + input[isRTL ? 'before' : 'after'](inst.append); + } var showOn = this._get(inst, 'showOn'); if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field input.focus(this._showDatepicker); @@ -277,9 +280,9 @@ $.extend(Datepicker.prototype, { var nodeName = target.nodeName.toLowerCase(); $.removeData(target, PROP_NAME); if (nodeName == 'input') { + inst.append.remove(); inst.trigger.remove(); - $target.siblings('.' + this._appendClass).remove().end(). - removeClass(this.markerClassName). + $target.removeClass(this.markerClassName). unbind('focus', this._showDatepicker). unbind('keydown', this._doKeyDown). unbind('keypress', this._doKeyPress); @@ -297,11 +300,10 @@ $.extend(Datepicker.prototype, { } var nodeName = target.nodeName.toLowerCase(); if (nodeName == 'input') { - target.disabled = false; - inst.trigger.filter("button"). - each(function() { this.disabled = false; }).end(). - filter("img"). - css({opacity: '1.0', cursor: ''}); + target.disabled = false; + inst.trigger.filter('button'). + each(function() { this.disabled = false; }).end(). + filter('img').css({opacity: '1.0', cursor: ''}); } else if (nodeName == 'div' || nodeName == 'span') { var inline = $target.children('.' + this._inlineClass); @@ -321,11 +323,10 @@ $.extend(Datepicker.prototype, { } var nodeName = target.nodeName.toLowerCase(); if (nodeName == 'input') { - target.disabled = true; - inst.trigger.filter("button"). - each(function() { this.disabled = true; }).end(). - filter("img"). - css({opacity: '0.5', cursor: 'default'}); + target.disabled = true; + inst.trigger.filter('button'). + each(function() { this.disabled = true; }).end(). + filter('img').css({opacity: '0.5', cursor: 'default'}); } else if (nodeName == 'div' || nodeName == 'span') { var inline = $target.children('.' + this._inlineClass); |