User "Krinkle" posted a comment on MediaWiki.r87212.
Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87212#c17832
Commit summary:
Added wgIsMainPage (Title->isMainPage) to mw.config
* Instead of ugly javascript construction to compare href-attributes or
re-constructing proper pagenames, let's use Title->isMainPage which does this
much better
* Kept function for compatibility. mw.util.isMainPage() was never released,
should probably be removed before 1.18 branch point.
Comment:
The global space is only legacy name. It's deprecated as of 1.17 since we're
exporting everything as a Map in mw.config, which, for now, stashes it's
key/value pairs onto <code>window</code> but there's a configuration option for
this already and I guess we're gonna flip it some time soon in trunk (1.20?).
Anyway, mw.config defaults to null if the key is unknown (and throw
ReferenceErrors exceptions about undefined variables), so in a way it's already
"a function that uses a private variable that is only defined on the main
page". mw.config either returns that variable or null.
<pre>if ( mw.config.get( 'isMainPage' ) { .. </pre>
If you think that's good enough I'll go ahead and make the change.
_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview