fix a bug in Ox.Input that would make its change event fire more than once
This commit is contained in:
parent
923ed92bd7
commit
8de69b3173
1 changed files with 13 additions and 1 deletions
|
@ -596,6 +596,15 @@ Ox.Input = function(options, self) {
|
|||
self.options.placeholder && setPlaceholder();
|
||||
self.options.validate && validate();
|
||||
self.bindKeyboard && Ox.UI.$document.unbind('keydown', keydown);
|
||||
if (!self.cancelled && !self.submitted) {
|
||||
that.triggerEvent('blur', {
|
||||
value: self.options.value
|
||||
});
|
||||
self.options.value !== self.originalValue && that.triggerEvent('change', {
|
||||
value: self.options.value
|
||||
});
|
||||
}
|
||||
/*
|
||||
self.options.value !== self.originalValue && that.triggerEvent('change', {
|
||||
value: self.options.value
|
||||
});
|
||||
|
@ -604,17 +613,20 @@ Ox.Input = function(options, self) {
|
|||
!self.cancelled && !self.submitted && that.triggerEvent('blur', {
|
||||
value: self.options.value
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
self.cancelled = true;
|
||||
self.$input.blur().val(self.originalValue);
|
||||
self.$input.val(self.originalValue).blur();
|
||||
self.cancelled = false;
|
||||
that.triggerEvent('cancel');
|
||||
}
|
||||
|
||||
function change() {
|
||||
// change gets invoked before blur
|
||||
self.options.value = self.$input.val();
|
||||
self.originalValue = self.options.value;
|
||||
that.triggerEvent('change', {
|
||||
value: self.options.value
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue