saper has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/247624

Change subject: Let CSS load before top JS queue starts
......................................................................

Let CSS load before top JS queue starts

Only execute minimal, inline JavaScript
before loading "top" CSS modules.

Seems to fix the flash of unstyled content
on the Special:UserLogin page.

Bug: T115692
Change-Id: I292d2999fa496079a3b8e03a76c63f1661c80614
---
M includes/OutputPage.php
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/24/247624/1

diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index d29ec54..ac22a02 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2705,6 +2705,7 @@
                $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . 
"\n";
                $ret .= $this->getInlineHeadScripts() . "\n";
                $ret .= $this->buildCssLinks() . "\n";
+               $ret .= $this->getScriptsForTopQueue() . "\n";
                $ret .= $this->getExternalHeadScripts() . "\n";
 
                foreach ( $this->getHeadLinksArray() as $item ) {
@@ -3014,11 +3015,18 @@
                // The "rest" includes browsers that support JavaScript but not 
supported by our runtime.
                // For the performance benefit of the majority, this is added 
unconditionally here and is
                // then fixed up by the startup module for unsupported browsers.
-               $links[] = Html::inlineScript(
+               return  Html::inlineScript(
                        'document.documentElement.className = 
document.documentElement.className'
                        . '.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" 
);'
                );
-
+       }
+       /**
+        * JS stuff to put at the 'top', which goes in the <head>
+        * These are modules marked with position 'top'
+        *
+        * @return string HTML fragment
+         */
+       function getScriptsForTopQueue() {
                // Load config before anything else
                $links[] = ResourceLoader::makeInlineScript(
                        ResourceLoader::makeConfigSetScript( $this->getJSVars() 
)

-- 
To view, visit https://gerrit.wikimedia.org/r/247624
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I292d2999fa496079a3b8e03a76c63f1661c80614
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: saper <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to