Add es5-shim library v3.4.0

With skip function to bypass loading in modern browsers.

Add dependency on es5-shim to OOjs and OOjs UI, and json2 to the former.

The ES5 skip function simply asserts the 'use strict' feature, which
means that all MSIE9 clients will recieve the library, which should
mostly be a no-op but will increase the load.

* Source code
  https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js

As OOjs UI isn't yet tested against non-ES5 browsers using this shim,
leaving the note about likely breakage for that one.

Change-Id: I2556b39d6040d99693f6b9d469b92951ffb2e7b2
This commit is contained in:
James D. Forrester 2014-06-12 16:19:46 -07:00 committed by Krinkle
parent cde0829227
commit fff9a814f2
3 changed files with 1464 additions and 2 deletions

View file

@ -1451,15 +1451,29 @@ return array(
'targets' => array( 'desktop', 'mobile' ),
),
/* es5-shim */
'es5-shim' => array(
'scripts' => array(
'resources/lib/es5-shim/es5-shim.js',
),
'skipFunction' => 'resources/src/es5-skip.js'
),
/* OOjs */
// WARNING: OOjs and OOjs-UI are NOT COMPATIBLE with older browsers and
// WILL BREAK if loaded in browsers that don't support ES5
'oojs' => array(
'scripts' => array(
'resources/lib/oojs/oojs.js',
),
'targets' => array( 'desktop', 'mobile' ),
'dependencies' => array(
'es5-shim',
'json',
),
),
/* OOjs UI */
// WARNING: OOjs-UI is NOT TESTED with older browsers and is likely to break
// if loaded in browsers that don't support ES5
'oojs-ui' => array(
'scripts' => array(
'resources/lib/oojs-ui/oojs-ui.js',
@ -1483,6 +1497,7 @@ return array(
'ooui-dialog-confirm-default-cancel'
),
'dependencies' => array(
'es5-shim',
'oojs',
),
'targets' => array( 'desktop', 'mobile' ),

File diff suppressed because it is too large Load diff

15
resources/src/es5-skip.js Normal file
View file

@ -0,0 +1,15 @@
/*!
* Skip function for es5-shim module.
*
* Test for strict mode as a proxy for full ES5 function support (but not syntax)
* Per http://kangax.github.io/compat-table/es5/ this is a reasonable short-cut
* that still allows this to be as short as possible (there are no function "No"s
* for non-"obsolete" real browsers where strict support is available).
*
* Note that this will cause IE9 users to get the shim (which should be close to
* a no-op but will increase page payload).
*/
return ( function () {
'use strict';
return !this;
}() );