The problem is coming from the Resource Loader [0] changes in MediaWiki 1.17, which loads JavaScript, such as wikibits.js, which contains addOnloadHook, at the end of page. Scripts attempting to use it before that point break. The solution is to simply use the resource loader when it's available. I have already changed SMWOutputs::requiredHeadItems [1] a while back to do exactly this. I'm not sure this covers 100% of the SMW JavaScript that got broken by the resource loader, so it'd be nice if people could try out trunk to see if everything is ok.

MediaWiki ships it's own jQuery since 1.16. SMW has it's own copy to be able to use it with MW 1.15.x. If the installed MW has it's own jQuery, that copy is used.

In any case, I think there is still work to be done to take full advantage of the benefits the resource loader provides. This will require some re-ordering or even re-writing of scripts at places though.

[0] http://www.mediawiki.org/wiki/Resource_loader
[1] http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php?r1=74097&r2=74195


Jeroen De Dauw
* http://blog.bn2vs.com
* http://wiki.bn2vs.com
Don't panic. Don't be evil. 50 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!

On 14 October 2010 00:17, Denny Vrandecic <denny.vrandecic@kit.edu> wrote:

it seems that the current MediaWiki has removed the addOnloadHook, and we depend on a number of places (tool tip, sortable tables, etc.)

I wanted to know if anyone has already looked into that, or if I should take a look?

Also, I would like to change the SMWOutputs::requiredHeadItems to use the addScriptFile method, as otherwise we cannot guarantee to have jQuery already loaded (which seems to provide the usual replacement for the addOnloadHook).

Another question: why does SMW include a jQuery library? Isn't there now one in MW proper?

I am finally not very sure on how this would all deal with downward compatibility, I mean it is a pain to write for 1.15 and 1.16 and 1.17. I understand that we should definitively keep with 1.16 (since it is the latest stable release), but how much of a pain would it be to drop 1.15?