danpalmer / jquery.complexify.js

Complexify helps you to accurately gauge the quality of a user's password to give them visual feedback, and to enforce a minimum level of security.
http://danpalmer.me/jquery-complexify
652 stars 189 forks source link

Bound events #14

Closed nickshanks closed 10 years ago

nickshanks commented 11 years ago

You should bind to the following events: input (for all modern browsers)

this doesn't fire, for example, when holding down the shift key it does fire when, for example, dragging or pasting text into the field.

And if on IE 9 or below, also these: propertychange (for IE < 9) keyup (for deleting in IE < 9, which doesn't fire propertychange, and contextual menu cut via keyboard in IE <= 9) mouseup (for contextual menu cut via mouse in IE <= 9)

This means you shouldn't need change or keyrepeat. This SO answer contains all the testing results for the various IE versions: http://stackoverflow.com/a/12871763/760706

I do not understand why you added focus. I assume it covers a case I have not thought of. What about blur?

danpalmer commented 11 years ago

Focus was added at the suggestion of #10 - handling the case of a reloaded form not being validated.

I'll add the others soon. Thanks for the tips.

Just so I'm clear, I don't do a lot of front-end JS, I need to bind to focus, input, propertychange, keyup and mouseup? Are all of those going to be needed and are there going to be cases when multiple handlers are called?

nickshanks commented 11 years ago

I don't do a lot, and am not sure if there are cases where one will always be called when another is, in all browsers, but since the function doesn't hurt to run multiple times, I felt it was better to be safe.

On 23 April 2013 18:12, Dan Palmer notifications@github.com wrote:

Focus was added at the suggestion of #10https://github.com/danpalmer/jquery.complexify.js/issues/10- handling the case of a reloaded form not being validated.

I'll add the others soon. Thanks for the tips.

Just so I'm clear, I don't do a lot of front-end JS, I need to bind to focus_, input_, propertychange, keyup and mouseup? Are all of those going to be needed and are there going to be cases when multiple handlers are called?

— Reply to this email directly or view it on GitHubhttps://github.com/danpalmer/jquery.complexify.js/issues/14#issuecomment-16872302 .

Nicholas.

danpalmer commented 10 years ago

Added in d0b4ab7