[mediawiki.js] code quality and clean up
authorKrinkle <krinkle@users.mediawiki.org>
Tue, 27 Dec 2011 18:25:20 +0000 (18:25 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Tue, 27 Dec 2011 18:25:20 +0000 (18:25 +0000)
commit407abe9c225e6889863390c14c4cdebd946720f9
tree8a69f2b559aa4057903704f7d128dd35277db9d8
parent9b3e0a7e1133bddd9c44582d0a2f20ba3da76683
[mediawiki.js] code quality and clean up
* using local mw variable in file instead of reaching to global scope
* exposing to global object after initialization
* moving var statements to the top of the function, this uncovered a few risky re-use of variables. Fixed by using different names (in nested for-loops and unconnected if/else statements). This also made several awkward indentions go away (where the first definition would be indented for 'var', and later ones not).
* remove unused "messageQueue" variable
* enable strict mode in modern browsers (loose string ignored in other browsers)
* where looking to check for array, use $.isArray() (directly pointed to native code) instead of a typeof operation with string comparison for "object" (slightly faster and also semantically more correct)
* other best practices as popularized by JSLint/JSHint
* removed 'delete' operator for startUp, didn't' do anything in most modern browsers, only for object members.

@note: mw.loader.work really is big, now it's more obvious:
<code>
+var reqBase, splits, maxQueryLength, q, b, bSource, bGroup, bSourceGroup,
+ source, group, g, i, modules, maxVersion, sourceLoadScript,
+ currReqBase, currReqBaseLength, moduleMap, l,
+ lastDotIndex, prefix, suffix, bytesAdded;
</code>
resources/mediawiki/mediawiki.js