]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker: Remove old "ui-datepicker-multi-N" before add new one. Fixed #6704 -...
authorKato Kazuyoshi <kato.kazuyoshi@gmail.com>
Wed, 4 May 2011 19:07:43 +0000 (04:07 +0900)
committerScott González <scott.gonzalez@gmail.com>
Wed, 4 May 2011 21:12:01 +0000 (17:12 -0400)
(cherry picked from commit fc97ccd398b60525fd9e4c0e9aa1f51048984394)

tests/unit/datepicker/datepicker_core.js
ui/jquery.ui.datepicker.js

index 2730ec86124846e20a5712c8b2633c31949e4527..3cb4a2f50ff7d02802a764bdb44555afded8e872 100644 (file)
@@ -121,8 +121,16 @@ test('baseStructure', function() {
        ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
        child = dp.children(':eq(2)');
        ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break');
+       ok(dp.is('.ui-datepicker-multi-2'), 'Structure multi [2] - multi-2');
        inp.datepicker('hide').datepicker('destroy');
        
+       // Multi-month 3
+       inp = init('#inp', {numberOfMonths: 3});
+       inp.focus();
+       ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
+       ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
+       inp.datepicker('hide').datepicker('destroy');
+
        // Multi-month [2, 2]
        inp = init('#inp', {numberOfMonths: [2, 2]});
        inp.focus();
index fe24d695a7fbd230904dab4b009a60feb5ed102f..2ab23a6ebb56501132c13bfe55a13de69814a8cd 100644 (file)
@@ -683,10 +683,9 @@ $.extend(Datepicker.prototype, {
                var numMonths = this._getNumberOfMonths(inst);
                var cols = numMonths[1];
                var width = 17;
+               inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
                if (cols > 1)
                        inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
-               else
-                       inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
                inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
                        'Class']('ui-datepicker-multi');
                inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +