jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/372075 )

Change subject: OutputPage: Turn html5shiv into a raw ResourceLoader module
......................................................................


OutputPage: Turn html5shiv into a raw ResourceLoader module

This lets us take advantage of ResourceLoader's on the fly minification
rather than needing to ship a minified copy, which is problematic for
other distributions like Debian.

Because the startup module excludes raw modules, it is not possible to
load or depend upon this module, and trying to use
`mw.loader.load('html5shiv')` for example will throw an exception.

This follows-up 3a30e03645f895b.

Change-Id: I635e224fb043c614c4918771c7c8f836575c683b
---
M includes/OutputPage.php
M resources/Resources.php
D resources/lib/html5shiv/html5shiv.min.js
3 files changed, 21 insertions(+), 11 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  Legoktm: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 7c463b6..5d9006a 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2923,15 +2923,14 @@
                $pieces = array_merge( $pieces, array_values( 
$this->getHeadLinksArray() ) );
                $pieces = array_merge( $pieces, array_values( $this->mHeadItems 
) );
 
-               $min = ResourceLoader::inDebugMode() ? '' : '.min';
                // Use an IE conditional comment to serve the script only to 
old IE
                $pieces[] = '<!--[if lt IE 9]>' .
-                       Html::element( 'script', [
-                               'src' => self::transformResourcePath(
-                                       $this->getConfig(),
-                                       
"/resources/lib/html5shiv/html5shiv{$min}.js"
-                               ),
-                       ] ) .
+                       ResourceLoaderClientHtml::makeLoad(
+                               ResourceLoaderContext::newDummyContext(),
+                               [ 'html5shiv' ],
+                               ResourceLoaderModule::TYPE_SCRIPTS,
+                               [ 'sync' => true ]
+                       ) .
                        '<![endif]-->';
 
                $pieces[] = Html::closeElement( 'head' );
diff --git a/resources/Resources.php b/resources/Resources.php
index f697e41..b31926b 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -2656,6 +2656,21 @@
                'targets' => [ 'desktop', 'mobile' ],
        ],
 
+       /**
+        * html5shiv
+        *
+        * This library is intended to run on older browsers
+        * that MediaWiki no longer supports as Grade A, and
+        * is not loaded through the normal module loading
+        * system.
+        */
+       'html5shiv' => [
+               'scripts' => [
+                       'resources/lib/html5shiv/html5shiv.js'
+               ],
+               'raw' => true,
+       ],
+
        /* OOjs */
        'oojs' => [
                'scripts' => [
diff --git a/resources/lib/html5shiv/html5shiv.min.js 
b/resources/lib/html5shiv/html5shiv.min.js
deleted file mode 100644
index 355afd1..0000000
--- a/resources/lib/html5shiv/html5shiv.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
-* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 
Licensed
-*/
-!function(a,b){function c(a,b){var 
c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return
 
c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function
 d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function 
e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof 
a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return 
b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return 
c.createElement(a);d||(d=f(c));var e;return 
e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function
 h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var 
e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return 
e}function 
i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return
 
t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return
 function(){var 
n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return
 b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return 
n}")(t,b.frag)}function j(a){a||(a=b);var 
d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var
 
k,l,m="3.7.3",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var
 a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in 
a,l=1==a.childNodes.length||function(){b.createElement("a");var 
a=b.createDocumentFragment();return"undefined"==typeof 
a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof 
a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr 
article aside audio bdi canvas data datalist details dialog figcaption figure 
footer header hgroup main mark meter nav output picture progress section 
summary template time 
video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof
 module&&module.exports&&(module.exports=t)}("undefined"!=typeof 
window?window:this,document);
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I635e224fb043c614c4918771c7c8f836575c683b
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to