2009/11/27 Tim Starling <tstarling(a)wikimedia.org>rg>:
Roan has re-added js2/js2stopgap.js. I would prefer to
see the JS2
functions in that file deprecated, and for extensions targeting 1.16
to use interfaces which we can more easily continue to support into
the future.
I'm all for it, as long as the existing feature set provided by
js2stopgap remains.
loadGM(), gM(): misnamed, neither should be global,
excessively
abbreviated and unintelligible function names. I suggest adding
mw.getMsg() and mw.addMessages() to wikibits.js.
$j: idiosyncratic, what's wrong with calling jQuery jQuery like
everyone else?
I have no idea why that was done. Note that the 'normal' alias for
jQuery (the one it also defines itself) is $ .
function js2AddOnloadHook( func ) {
$j(document).ready( func );
}
The "js2" prefix will disappear from all interfaces in a future
version. Callers can just use jQuery(document).ready() directly.
mvJsLoader = { doLoad: function( deps, callback ) { callback(); } };
Note that mv is an abbreviation for Metavid, nothing that starts with
mv belongs in the core. Calls to this should just be removed for now,
since it doesn't do anything. There will eventually be a function
called mw.load() which does a similar thing.
The filename, js2/js2stopgap.js, has the problem of containing js2 not
once but twice. I have previously suggested adding an
OutputPage::addJQuery() interface, which removes the need to specify
the filename in the extension and can be designed to avoid the
possibility of duplicate script tags. I still think that this is a
good idea.
I agree; I must've missed this the first time you suggested it.
Roan Kattouw (Catrope)