acstll / jquery-validity

2 stars 1 forks source link

`fields` is global to all form instances #1

Closed acstll closed 8 years ago

acstll commented 8 years ago

https://github.com/acstll/jquery-validity/blob/master/index.js#L12

taoeffect commented 8 years ago

Isn't this a pretty simple fix? Just moving it into $.fn.validity?

acstll commented 8 years ago

Maybe, I'm not sure is that easy, though should be a simple fix indeed.

The problem is that if you have more than one form element in your selection (if you do $('form').validity() for example), all fields of all forms would be in that same "global" variable, which would make all forms run validation logic while the user is interacting with only one.

Would you mind copy/pasting an example of what you mean? There are no proper tests to check against right now, but if you feel like trying a PR, that is also welcomed :-)