Topic on Project:Village Pump

All JavaScript broken in Opera due to jQuery not loaded?

7
TMg (talkcontribs)
[21.10.2011 17:03:17] JavaScript - http://www.mediawiki.org/w/index.php?title=Project:Current_issues&action=submit
Inline script thread
Uncaught exception: ReferenceError: Undefined variable: jQuery
Error thrown at line 37, column 0 in http://www.mediawiki.org/w/index.php?title=Special:BannerController&cache=/cn.js&303-4:
    ( function( $ ) {

Currently, all JavaScript on mediawiki.org is broken when using the Opera web browser. I was able to track the problem down to Special:BannerController. In the last line it depends on a variable jQuery that does not exists (at least when using Opera). The script crashs and no other script is executed. Due to this error the coding challenge page is broken.

Eloquence (talkcontribs)

Thanks for the report; we'll look into it.

Brooke Vibber (talkcontribs)

What version of Opera, on what operating system? I see no obvious problems under Opera 11.52 (current release) on Mac OS X 10.7 which I have handy.

I do recall hearing something about there possibly being a problem on old versions of Opera that jQuery no longer supports; might you be running one of these versions? We'll need to check the fallback behavior and see what's going on...

TMg (talkcontribs)

Happened in the current Opera 11.52, running on Windows 7 behind a company firewall. It worked in Firefox 7 on the same machine. At the moment, I can not reproduce it. On an other machine (and other network) it works in all browsers, including Opera.

TMg (talkcontribs)

I found the error. It happens with the NoAds Opera extension installed and active. In the last step of your "startup" module this line is executed:

document.write("\x3cscript src=\"//bits.wikimedia.org/www.mediawiki.org/load.php?debug=true\x26amp;lang=en\x26amp;modules=jquery%2Cmediawiki\x26amp;only=scripts\x26amp;skin=vector\x26amp;version=20111007T213533Z\"\x3e\x3c/script\x3e");

This line is blocked by the extension. But it is not blocked at wikipedia.org. Why not? My answer: There is a difference in both scripts. At the end of the line shown above this part is missing:

type=\"text/javascript\"

Please add this.

PS: The function linkedScript() in Html.php does not output the type attribute in HTML5 mode. Why not? Please always output the type attribute for compatibility reasons, even if it's the default value type="text/javascript". It's not wrong to do this according to the spec.

PPS: Reported at bugzilla:31920.

PPPS: I'm sorry. I was sure I found the reason but adding type="text/javascript" does not help. Still a strange bug. No problem at de.wikipedia.org with this (bad) extension enabled. I think I will look for an other extension that's better maintained.

PPPPS: Same problem with an other extension. The reason is pretty simple: It blocks all external scripts. wikipedia.org is on the default white list that comes with the extension. mediawiki.org is not on the white list. That's the difference.

PPPPPS: How do I edit the wrong date under this post? --TMg 00:00, 25 October 2011 (UTC)

Krinkle (talkcontribs)

The timestamp of discussion thread entries can not be changed. It reflects the creation date, which is correct. Later edits are noted on the top right, if any

Krinkle (talkcontribs)

The absence of the type-attribute is unlikely a problem. One of the reasons it was safely removed in HTML5 is because older browsers (even those without special HTML5 support) already defaulted to 'text/javascript').

If you think it is the problem though, feel free to check out MediaWiki and see if it works if you re-add that attribute in a local patch.

Reply to "All JavaScript broken in Opera due to jQuery not loaded?"