Last modified: 2011-04-06 22:06:51 UTC
Currently wikibits.js breaks (causes JS errors) anytime someone has no javascript globals (no call to Skin::makeGlobalVariablesScript). There are currently 3 globals fetched on the assumption that they are defined. It would be nice to have it not puke and die (and not define any mediawiki js functions at all, and often abort all further javascript on a page) when/if they're missing. This can happen when someone is using a custom skin that wasn't upgraded along with MediaWiki (either they recently upgraded, or grabbed a skin not meant for the version they have). Several times people have complained of javascript problems with their skin, due to their skin sucking. It wouldn't be so bad, except it breaks /all/ javascript for them, until they can either fix the skin themselves, or find the maintainer (if one exists) to fix it. Also, wikibits.js might be a useful js to include with action=render for things like custom mini static dumps, and such.
Created attachment 6384 [details] Example patch of wikibits.js without global requirements Here is an example patch to make wikibits.js not fail without globals. The stylepath change is a bit concerning, but a null stylepath here shouldn't really cause problems (or rather, any /more/ problems than that of the JS being totally broken). A better solution would be to replace cases of 'stylepath' calls in sorttable with a dummy variable assigned to the value of stylepth (or null if undefined), maybe.
Random note before I forget - the stylepath line should be either: if (typeof stylepath == 'undefined') var stylepath = ""; or this shorter version (from Splarka): var stylepath = stylepath || "";
* wikbits.js is already deprecated, up to be quarantined in 1.19 into mw.legacy * global wg* variables are also deprecated and moved to mw.config, currently still shadowed to the global space as well for backwards compatibility. All usage in core is or soon will be replaced. One of the advantages to mw.config is that it wont cause any 'undefined' errors (takes care of that internally through the mw.Map() constructor)