Last modified: 2011-03-13 18:05:17 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T18258, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 16258 - User custom JS <script> tag changes location in some MW skins
User custom JS <script> tag changes location in some MW skins
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Lowest normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://meta.wikimedia.org/wiki/Main_Page
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-06 10:54 UTC by Haza-w
Modified: 2011-03-13 18:05 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Haza-w 2008-11-06 10:54:43 UTC
For some reason, certain skins cause the Javascript elements in the document head to appear in a different order, causing user scripts to break if they depend on a script which appears after their user JS is invoked.

Monobook, Chick, Modern, MySkin and Simple call the JS scripts in the correct order - ie. site JS and custom user script at the end of the document head, shown below.

		<script type="text/javascript" src="/skins-1.5/common/wikibits.js?182"><!-- wikibits js --></script>
		<!-- Head Scripts -->
		<script type="text/javascript" src="/skins-1.5/common/ajax.js?182"></script>
		<script type="text/javascript" src="/skins-1.5/common/ajaxwatch.js?182"></script>
		<script type="text/javascript" src="/skins-1.5/common/mwsuggest.js?182"></script>

<script type="text/javascript">/*<![CDATA[*/
var wgNotice='';var wgNoticeLocal='';
/*]]>*/</script>		<script type="text/javascript" src="http://upload.wikimedia.org/centralnotice/wikimedia/en/centralnotice.js?182"></script>
		<script type="text/javascript" src="/w/index.php?title=-&amp;action=raw&amp;smaxage=0&amp;gen=js&amp;useskin=monobook"><!-- site js --></script>
		<script type="text/javascript" src="/w/index.php?title=User:Haza-w/monobook.js&amp;action=raw&amp;ctype=text/javascript"></script>
	</head>

Classic, Cologne Blue and Nostalgia call the site JS and custom user script *before* some of the other JS libraries, which causes scripts dependent on those libraries to break.

		<script type="text/javascript" src="/skins-1.5/common/wikibits.js?182"></script>
		<script type="text/javascript" src="/w/index.php?title=-&amp;action=raw&amp;smaxage=0&amp;gen=js&amp;useskin=standard"><!-- site js --></script>
		<script type="text/javascript" src="/w/index.php?title=User:Haza-w/standard.js&amp;action=raw&amp;ctype=text/javascript"></script>				<script type="text/javascript" src="/skins-1.5/common/ajax.js?182"></script>

		<script type="text/javascript" src="/skins-1.5/common/ajaxwatch.js?182"></script>
		<script type="text/javascript" src="/skins-1.5/common/mwsuggest.js?182"></script>
<script type="text/javascript">/*<![CDATA[*/
var wgNotice='';var wgNoticeLocal='';
/*]]>*/</script>		<script type="text/javascript" src="http://upload.wikimedia.org/centralnotice/wikimedia/en/centralnotice.js?182"></script>
		</head>

The cause of the bug might not rest with the skins themselves, but it would be useful if this were diagnosed and rectified.
Comment 1 Splarka 2008-11-06 11:05:23 UTC
More fully documented (by me, annoying amount of work) at http://en.wikipedia.org/wiki/Wikipedia:Catalogue_of_CSS_classes#Stylesheets_and_JavaScript (except they changed it with the central notice, which I am ignoring as it is transient for the next few weeks and will totally change next year, like every year).

Can you give an example of such a script that breaks? Basically my rule of thumb is: if you rely on any javascript that isn't in the global definition (wgPagename etc) or wikibits.js, use it inside an addOnloadHook().

Comment 2 Haza-w 2008-11-06 21:00:31 UTC
I don't know of any that break for this reason, to be honest - I encountered the issue when creating an AJAX-dependent extension to http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/Six_tabs and testing it for cross-skin compatibility.

If it's a non-issue, then there's no need for a fix. I just thought that continuity would be better than disparity in this context, since it makes logical sense for gadgets and user scripts to be executed after the global and skin scripts.

That's an excellent resource, by the way... definitely going into the bookmarks :)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links