mailgun / validator-demo

Mailgun email address jquery validation plugin http://mailgun.github.io/validator-demo/
Apache License 2.0
257 stars 80 forks source link

change instead of focusout? #16

Open kevinmickey opened 8 years ago

kevinmickey commented 8 years ago

I know duplicates are caught, but wouldn't running on change instead of focusout be simpler and have a little better performance?

msigley commented 8 years ago

The change event can be inconsistent as to when it is fired for an input across the browsers. Older browsers would fire the event for each keystroke in the input, then it turned into each keystroke with a delay to try and increase performance, and now the event is in the inconsistent state it is now.

It is always better to use focusout/focusin or input events for consistancy, especially with jquery. Because of the lack of focusout support in Firefox, it probably actually uses the change event in the jquery code to emulate the focusout event.