Skip to content

Commit

Permalink
Datepicker: Removed click handling for month and year dropdowns. Fixe…
Browse files Browse the repository at this point in the history
…s #6198 - Datepicker Month and Year dropdowns in IE have to click twice.

Thanks jdufresne
(cherry picked from commit 70687f7)
  • Loading branch information
scottgonzalez committed Aug 1, 2011
1 parent bd48ddf commit 1d47956
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions ui/jquery.ui.datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,26 +878,13 @@ $.extend(Datepicker.prototype, {
_selectMonthYear: function(id, select, period) {
var target = $(id);
var inst = this._getInst(target[0]);
inst._selectingMonthYear = false;
inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
parseInt(select.options[select.selectedIndex].value,10);
this._notifyChange(inst);
this._adjustDate(target);
},

/* Restore input focus after not changing month/year. */
_clickMonthYear: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
if (inst.input && inst._selectingMonthYear) {
setTimeout(function() {
inst.input.focus();
}, 0);
}
inst._selectingMonthYear = !inst._selectingMonthYear;
},

/* Action for selecting a day. */
_selectDay: function(id, month, year, td) {
var target = $(id);
Expand Down Expand Up @@ -1603,7 +1590,6 @@ $.extend(Datepicker.prototype, {
var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
monthHtml += '<select class="ui-datepicker-month" ' +
'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
'>';
for (var month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) &&
Expand Down Expand Up @@ -1637,7 +1623,6 @@ $.extend(Datepicker.prototype, {
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
inst.yearshtml += '<select class="ui-datepicker-year" ' +
'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
'>';
for (; year <= endYear; year++) {
inst.yearshtml += '<option value="' + year + '"' +
Expand Down

0 comments on commit 1d47956

Please sign in to comment.