r2592 - datepicker: removed inline onclick and onchange attributes from month/year dropdowns (tod...
Author: pazu2k@gmail.com
Date: Wed May 20 11:41:07 2009
New Revision: 2592
Modified:
branches/dev/datepicker/ui/ui.datepicker.js
Log:
datepicker: removed inline onclick and onchange attributes from month/year
dropdowns (todo: reduce html re-generation and event re-binding processes)
Modified: branches/dev/datepicker/ui/ui.datepicker.js
==============================================================================
--- branches/dev/datepicker/ui/ui.datepicker.js (original)
+++ branches/dev/datepicker/ui/ui.datepicker.js Wed May 20 11:41:07 2009
@@ -629,6 +629,22 @@
self._selectDay('#'+inst.id, m, y, this);
})
.end()
+ .find('select.ui-datepicker-month')
+ .bind('change', function() {
+ self._selectMonthYear('#'+inst.id, this, 'M');
+ })
+ .bind('click', function() {
+ self._clickMonthYear('#'+inst.id);
+ })
+ .end()
+ .find('select.ui-datepicker-year')
+ .bind('change', function() {
+ self._selectMonthYear('#'+inst.id, this, 'Y');
+ })
+ .bind('click', function() {
+ self._clickMonthYear('#'+inst.id);
+ })
+ .end()
.find('.' + this._dayOverClass + ' a')
.trigger('mouseover')
.end();
@@ -1449,10 +1465,7 @@
else {
var inMinYear = (minDate && minDate.getFullYear() == drawYear);
var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
- monthHtml += '<select class="ui-datepicker-month" ' +
- 'onchange="DP_jQuery.ui.datepicker._selectMonthYear(\'#' + inst.id
+ '\', this, \'M\');" ' +
- 'onclick="DP_jQuery.ui.datepicker._clickMonthYear(\'#' + inst.id
+ '\');"' +
- '>';
+ monthHtml += '<select class="ui-datepicker-month">';
for (var month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) &&
(!inMaxYear || month <= maxDate.getMonth()))
@@ -1484,10 +1497,7 @@
}
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) :
endYear);
- html += '<select class="ui-datepicker-year" ' +
- 'onchange="DP_jQuery.ui.datepicker._selectMonthYear(\'#' + inst.id
+ '\', this, \'Y\');" ' +
- 'onclick="DP_jQuery.ui.datepicker._clickMonthYear(\'#' + inst.id
+ '\');"' +
- '>';
+ html += '<select class="ui-datepicker-year">';
for (; year <= endYear; year++) {
html += '<option value="' + year + '"' +
(year == drawYear ? ' selected="selected"' : '') +