(follow-up r80554) If person typed max amount in edit summary, backspace didn't work on some versions of opera

This still doesn't recognize all special keys on affected versions of opera as
keystrokes to ignore. I don't think this is a big issue, since backspace
is recognized (which is the only key thats really important), newer
versions of Opera should not be affected, and (based on a skim of the jQuery
site) it appears that if we ever upgrade our version of jQuery, the issue
might go away. (not 100% sure about that last part)

Originally when i was testing this code, I tested in all sorts of browsers
that it would stop people from putting more text in. I never tested that
it would allow backspaces (I now have, opera was the only affected one where
it didn't work).

Thanks to Alex Smotrov for reporting issue.
This commit is contained in:
Brian Wolff 2011-03-02 03:57:58 +00:00
parent e2ba564eb7
commit 3e237f164b

View file

@ -11,7 +11,13 @@
// JQuery should also normalize e.which to be consistent cross-browser,
// however the same check is still needed regardless of jQuery.
if ( e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey ) {
// Note: At the moment, for some older opera versions (~< 10.5)
// some special keys won't be recognized (aka left arrow key).
// Backspace will be, so not big issue.
if ( e.which === 0 || e.charCode === 0 || e.which === 8 ||
e.ctrlKey || e.altKey || e.metaKey )
{
return true; //a special key (backspace, etc) so don't interfere.
}