Skip to content

Commit

Permalink
fix: replace 'change' to 'click' and 'keyup' in case of IE8 (fix #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
heenakwag authored and jung-han committed Aug 1, 2019
1 parent a19909e commit c90e0ec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src/js/timepicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,16 @@ var TimePicker = snippet.defineClass(/** @lends TimePicker.prototype */ {
* @private
*/
_setEvents: function() {
var type = 'change';
if (snippet.browser.msie && snippet.browser.version === 8) {
type = 'click';
}

this._hourInput.on('change', this._onChangeTimeInput, this);
this._minuteInput.on('change', this._onChangeTimeInput, this);

if (this._showMeridiem) {
domUtil.on(this._container, 'change', this._onChangeMeridiem, this);
domUtil.on(this._container, type, this._onChangeMeridiem, this);
}
},

Expand All @@ -229,7 +234,7 @@ var TimePicker = snippet.defineClass(/** @lends TimePicker.prototype */ {
this._minuteInput.destroy();

if (this._showMeridiem) {
domUtil.off(this._container, 'change', this._onChangeMeridiem, this);
domUtil.off(this._container, 'change click', this._onChangeMeridiem, this);
}
},

Expand Down
9 changes: 7 additions & 2 deletions src/js/timepicker/selectbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ var Selectbox = snippet.defineClass(/** @lends Selectbox.prototype */ {
* @private
*/
_setEvents: function() {
domUtil.on(this._container, 'change', this._onChangeHandler, this);
var type = 'change';
if (snippet.browser.msie && snippet.browser.version === 8) {
type = 'click';
}

domUtil.on(this._container, type, this._onChangeHandler, this);

this.on('changeItems', function(items) {
this._items = items;
Expand All @@ -140,7 +145,7 @@ var Selectbox = snippet.defineClass(/** @lends Selectbox.prototype */ {
_removeEvents: function() {
this.off();

domUtil.off(this._container, 'change', this._onChangeHandler, this);
domUtil.off(this._container, 'change click', this._onChangeHandler, this);
},

/**
Expand Down
9 changes: 7 additions & 2 deletions src/js/timepicker/spinbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,14 @@ var Spinbox = snippet.defineClass(/** @lends Spinbox.prototype */ {
* @private
*/
_setEvents: function() {
var type = 'change';
if (snippet.browser.msie && snippet.browser.version === 8) {
type = 'keyup';
}

domUtil.on(this._container, 'click', this._onClickHandler, this);
domUtil.on(this._container, 'keydown', this._onKeydownInputElement, this);
domUtil.on(this._container, 'change', this._onChangeHandler, this);
domUtil.on(this._container, type, this._onChangeHandler, this);

this.on('changeItems', function(items) {
this._items = items;
Expand All @@ -156,7 +161,7 @@ var Spinbox = snippet.defineClass(/** @lends Spinbox.prototype */ {

domUtil.off(this._container, 'click', this._onClickHandler, this);
domUtil.off(this._container, 'keydown', this._onKeydownInputElement, this);
domUtil.off(this._container, 'change', this._onChangeHandler, this);
domUtil.off(this._container, 'change keyup', this._onChangeHandler, this);
},

/**
Expand Down

0 comments on commit c90e0ec

Please sign in to comment.