r70523 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70522‎ | r70523 | r70524 >
Date:20:11, 5 August 2010
Author:maxsem
Status:ok
Tags:
Comment:
Improvement for r70521: simplification, avoid iterating over an array. Thanks, thedj!
Modified paths:
  • /trunk/phase3/skins/common/password.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/password.js
@@ -31,15 +31,9 @@
3232 if ( matches ) {
3333 charClasses++;
3434
 35+ var s = matches.join( '' );
3536 // poor man's isUpper() and isLower()
36 - var i, lower = false, upper = false;
37 - for ( i in matches ) {
38 - var ch = matches[i];
39 - upper |= ch != ch.toLowerCase();
40 - lower |= ch != ch.toUpperCase();
41 - if ( upper && lower ) break;
42 - }
43 - if ( upper && lower ) {
 37+ if ( s != s.toLowerCase() && s != s.toUpperCase() ) {
4438 charClasses++;
4539 }
4640 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70521Follow-up to r70520: forgot to add new filesmaxsem19:18, 5 August 2010

Status & tagging log