User "Krinkle" posted a comment on MediaWiki.r98563.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/98563#c23637
Commit summary:

Followup r98500, conversion of the Javascript to use jQuery fully. It also 
makes the Javascript work outside of debug=1 (oops)

There's a couple of WTF moments in the code, this is really due to some issues 
with the PHP side of stuff. It really needs some TLC but for right now it 
works, I'll come back to it before 1.19 and clean it up.

Comment:

<blockquote><em>
<pre>new ( function( $, mw ) {</pre>
I'd recommend turning this into an object instead of an anonymous 
immediately-invoked object constructor. Nothing in here has "state", they're 
basically 'static' functions.
If at some point it would have state, or if you prefer to have this as a 
constructor/class, then assign the constructor to a variable and instantiate it 
later (ie. <code>var categoryTree = function(){ .. }; categoryTree.prototype { 
showToggles: function(){ .. }, .. };</code> and instantiate it somewhere public 
(i.e. <code>mw.categoryTree = new categoryTree();</code>).
</em></bockquote>

But since it doesn't have state, it's probably easiest to just but it into a 
static object <code>var categoryTree = { showToggles: function(){ .. }, .. 
};</code>.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to