Skip to content

Commit

Permalink
add event detection back for element ui closes #841
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Sep 23, 2017
1 parent 4d89e1a commit 2ed3bf6
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 8 deletions.
9 changes: 8 additions & 1 deletion dist/vee-validate.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4210,7 +4210,14 @@ Field.prototype.addValueListeners = function addValueListeners () {
var fn = this.targetOf ? function () {
this$1.validator.validate(("#" + (this$1.targetOf)));
} : function () {
this$1.validator.validate(("#" + (this$1.id)));
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];

// if its a DOM event, resolve the value, otherwise use the first parameter as the value.
if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || args[0].srcElement) {
args[0] = this$1.value;
}
this$1.validator.validate(("#" + (this$1.id)), args[0]);
};

var validate = debounce(fn, this.delay);
Expand Down
9 changes: 8 additions & 1 deletion dist/vee-validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5308,7 +5308,14 @@ Field.prototype.addValueListeners = function addValueListeners () {
var fn = this.targetOf ? function () {
this$1.validator.validate(("#" + (this$1.targetOf)));
} : function () {
this$1.validator.validate(("#" + (this$1.id)));
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];

// if its a DOM event, resolve the value, otherwise use the first parameter as the value.
if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || args[0].srcElement) {
args[0] = this$1.value;
}
this$1.validator.validate(("#" + (this$1.id)), args[0]);
};

var validate = debounce(fn, this.delay);
Expand Down
2 changes: 1 addition & 1 deletion dist/vee-validate.min.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion dist/vee-validate.minimal.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1862,7 +1862,14 @@ Field.prototype.addValueListeners = function addValueListeners () {
var fn = this.targetOf ? function () {
this$1.validator.validate(("#" + (this$1.targetOf)));
} : function () {
this$1.validator.validate(("#" + (this$1.id)));
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];

// if its a DOM event, resolve the value, otherwise use the first parameter as the value.
if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || args[0].srcElement) {
args[0] = this$1.value;
}
this$1.validator.validate(("#" + (this$1.id)), args[0]);
};

var validate = debounce(fn, this.delay);
Expand Down
9 changes: 8 additions & 1 deletion dist/vee-validate.minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,14 @@ Field.prototype.addValueListeners = function addValueListeners () {
var fn = this.targetOf ? function () {
this$1.validator.validate(("#" + (this$1.targetOf)));
} : function () {
this$1.validator.validate(("#" + (this$1.id)));
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];

// if its a DOM event, resolve the value, otherwise use the first parameter as the value.
if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || args[0].srcElement) {
args[0] = this$1.value;
}
this$1.validator.validate(("#" + (this$1.id)), args[0]);
};

var validate = debounce(fn, this.delay);
Expand Down
2 changes: 1 addition & 1 deletion dist/vee-validate.minimal.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/core/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,12 @@ export default class Field {

const fn = this.targetOf ? () => {
this.validator.validate(`#${this.targetOf}`);
} : () => {
this.validator.validate(`#${this.id}`);
} : (...args) => {
// if its a DOM event, resolve the value, otherwise use the first parameter as the value.
if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || args[0].srcElement) {
args[0] = this.value;
}
this.validator.validate(`#${this.id}`, args[0]);
};

const validate = debounce(fn, this.delay);
Expand Down

0 comments on commit 2ed3bf6

Please sign in to comment.