r52886 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52885‎ | r52886 | r52887 >
Date:04:52, 8 July 2009
Author:mrzman
Status:ok (Comments)
Tags:
Comment:
Make importScriptURI() use a <link> in all cases.
Previously it used document.createStyleSheet for IE (which appears to be the only browser that supports it) or @import for everything else
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -73,8 +73,14 @@
7474 return importStylesheetURI(wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent(page.replace(/ /g,'_')));
7575 }
7676
77 -function importStylesheetURI(url) {
78 - return document.createStyleSheet ? document.createStyleSheet(url) : appendCSS('@import "' + url + '";');
 77+function importStylesheetURI(url,media) {
 78+ var l = document.createElement('link');
 79+ l.type = 'text/css';
 80+ l.rel = 'stylesheet';
 81+ l.href = url;
 82+ if(media) l.media = media
 83+ document.getElementsByTagName('head')[0].appendChild(l);
 84+ return l;
7985 }
8086
8187 function appendCSS(text) {
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1523,7 +1523,7 @@
15241524 * to ensure that client-side caches do not keep obsolete copies of global
15251525 * styles.
15261526 */
1527 -$wgStyleVersion = '228';
 1527+$wgStyleVersion = '229';
15281528
15291529
15301530 # Server-side caching:

Comments

#Comment by Mr.Z-man (talk | contribs)   04:53, 8 July 2009

(patch by Splarka)

#Comment by Mr.Z-man (talk | contribs)   04:59, 8 July 2009

and that should be importStylesheetURI in the commit message

Status & tagging log