r76324 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76323‎ | r76324 | r76325 >
Date:18:37, 8 November 2010
Author:krinkle
Status:ok
Tags:
Comment:
created addCSS function in mw.util based on legacy.wikibits
Modified paths:
  • /trunk/phase3/resources/mediawiki.util/mediawiki.util.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.js
@@ -95,6 +95,25 @@
9696 },
9797
9898 /**
 99+ * Append a new style block to the head
 100+ *
 101+ * @param text String CSS to be appended
 102+ * @return the CSS stylesheet
 103+ */
 104+ 'addCSS' : function( text ) {
 105+ var s = document.createElement( 'style' );
 106+ s.type = 'text/css';
 107+ s.rel = 'stylesheet';
 108+ if ( s.styleSheet ) {
 109+ s.styleSheet.cssText = text; // IE
 110+ } else {
 111+ s.appendChild( document.createTextNode( text + '' ) ); // Safari sometimes borks on null
 112+ }
 113+ document.getElementsByTagName("head")[0].appendChild( s );
 114+ return s.sheet || s;
 115+ },
 116+
 117+ /**
99118 * Get the full URL to a page name
100119 *
101120 * @param str Page name to link to

Status & tagging log