tgriesser / checkit

simple, flexible validations for node and the browser
MIT License
223 stars 53 forks source link

Why clone the `this.target` object? #73

Open greduan opened 8 years ago

greduan commented 8 years ago

https://github.com/tgriesser/checkit/blame/master/core.js#L121

That line is causing issues for a project I'm working on, because we need this.target to retain its properties that it inherits through prototype, but they're being lost by that one line.

Is there a reason why you're cloning it?

Here's some pics of the problem:

Here I'm highlighting the object we want as this.target in the validation:

screen shot 2016-07-07 at 16 43 42

But then over here, because of the clone that __proto__ information gets lost and this.target is no longer the same object.

screen shot 2016-07-07 at 16 43 45

Is there a reason why you decided to do that clone there?