Load 'mediawiki.legacy.commonPrint' styles with a media type property
authorKunal Mehta <legoktm@gmail.com>
Mon, 10 Aug 2015 04:44:27 +0000 (21:44 -0700)
committerOri.livneh <ori@wikimedia.org>
Mon, 10 Aug 2015 16:38:07 +0000 (16:38 +0000)
Split the 'mediawiki.legacy.commonPrint' styles into a separate <style>
tag which sets media="print", which will make it a non-render blocking
resource.

Bug: T108413
Change-Id: Ife1d65b31bc79f96d7b89b94fdaeb2babf7ddf40

includes/OutputPage.php
resources/Resources.php

index 72d8a7c..26f9efa 100644 (file)
@@ -2909,7 +2909,8 @@ class OutputPage extends ContextSource {
 
                                // Automatically select style/script elements
                                if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
-                                       $link = Html::linkedStyle( $url );
+                                       $media = $group === 'print' ? 'print' : 'all';
+                                       $link = Html::linkedStyle( $url, $media );
                                } else {
                                        if ( $context->getRaw() || $isRaw ) {
                                                // Startup module can't load itself, needs to use <script> instead of mw.loader.load
index 2396128..24c150e 100644 (file)
@@ -1674,6 +1674,7 @@ return array(
                'styles' => array(
                        'resources/src/mediawiki.legacy/commonPrint.css' => array( 'media' => 'print' )
                ),
+               'group' => 'print',
        ),
        'mediawiki.legacy.protect' => array(
                'scripts' => 'resources/src/mediawiki.legacy/protect.js',