[Core JS] mw.util.addCSS: Insert style tag into dom before setting cssText
authorKrinkle <krinkle@users.mediawiki.org>
Wed, 21 Dec 2011 22:08:52 +0000 (22:08 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Wed, 21 Dec 2011 22:08:52 +0000 (22:08 +0000)
* Fixes bug 33305

RELEASE-NOTES-1.19
resources/mediawiki/mediawiki.util.js

index f33498b..f5acada 100644 (file)
@@ -194,6 +194,8 @@ production.
 * (bug 33156) Special:Block now allows you to confirm you want to block yourself
   when using non-normalized username
 * (bug 33246) News icon shown for news:// URLs but not for news: URLs
+* (bug 33305) Make mw.util.addCSS resistant to IE's @font-face bug with setting
+  cssText before DOM insertion.
 
 === API changes in 1.19 ===
 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
index b6e0e42..d9aa20e 100644 (file)
                        var s = document.createElement( 'style' );
                        s.type = 'text/css';
                        s.rel = 'stylesheet';
+                       // Insert into document before setting cssText (bug 33305)
+                       document.getElementsByTagName('head')[0].appendChild( s );
                        if ( s.styleSheet ) {
                                s.styleSheet.cssText = text; // IE
                        } else {
                                // Safari sometimes borks on null
                                s.appendChild( document.createTextNode( text + '' ) );
                        }
-                       document.getElementsByTagName('head')[0].appendChild( s );
                        return s.sheet || s;
                },