diff --git a/js/vendor/jquery/jquery-migrate-3.0.0.js b/js/vendor/jquery/jquery-migrate.js similarity index 74% rename from js/vendor/jquery/jquery-migrate-3.0.0.js rename to js/vendor/jquery/jquery-migrate.js index 05b1a803c2..6ba8af4a42 100644 --- a/js/vendor/jquery/jquery-migrate-3.0.0.js +++ b/js/vendor/jquery/jquery-migrate.js @@ -1,37 +1,51 @@ /*! - * jQuery Migrate - v3.0.0 - 2016-06-09 + * jQuery Migrate - v3.0.1 - 2017-09-26 * Copyright jQuery Foundation and other contributors */ -(function( jQuery, window ) { +;( function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery" ], window, factory ); + } else if ( typeof module === "object" && module.exports ) { + + // Node/CommonJS + // eslint-disable-next-line no-undef + module.exports = factory( require( "jquery" ), window ); + } else { + + // Browser globals + factory( jQuery, window ); + } +} )( function( jQuery, window ) { "use strict"; -jQuery.migrateVersion = "3.0.0"; +jQuery.migrateVersion = "3.0.1"; +/* exported migrateWarn, migrateWarnFunc, migrateWarnProp */ ( function() { + var rbadVersions = /^[12]\./; + // Support: IE9 only // IE9 only creates console object when dev tools are first opened - // Also, avoid Function#bind here to simplify PhantomJS usage - var log = window.console && window.console.log && - function() { window.console.log.apply( window.console, arguments ); }, - rbadVersions = /^[12]\./; - - if ( !log ) { + // IE9 console is a host object, callable but doesn't have .apply() + if ( !window.console || !window.console.log ) { return; } // Need jQuery 3.0.0+ and no older Migrate loaded if ( !jQuery || rbadVersions.test( jQuery.fn.jquery ) ) { - log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" ); + window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" ); } if ( jQuery.migrateWarnings ) { - log( "JQMIGRATE: Migrate plugin loaded multiple times" ); + window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" ); } // Show a message on the console so devs know we're active - log( "JQMIGRATE: Migrate is installed" + + window.console.log( "JQMIGRATE: Migrate is installed" + ( jQuery.migrateMute ? "" : " with logging active" ) + ", version " + jQuery.migrateVersion ); @@ -74,11 +88,22 @@ function migrateWarnProp( obj, prop, value, msg ) { get: function() { migrateWarn( msg ); return value; + }, + set: function( newValue ) { + migrateWarn( msg ); + value = newValue; } } ); } -if ( document.compatMode === "BackCompat" ) { +function migrateWarnFunc( obj, prop, newFunc, msg ) { + obj[ prop ] = function() { + migrateWarn( msg ); + return newFunc.apply( this, arguments ); + }; +} + +if ( window.document.compatMode === "BackCompat" ) { // JQuery has never supported or tested Quirks Mode migrateWarn( "jQuery is not compatible with Quirks Mode" ); @@ -115,7 +140,7 @@ jQuery.find = function( selector ) { // The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0 // First see if qS thinks it's a valid selector, if so avoid a false positive try { - document.querySelector( selector ); + window.document.querySelector( selector ); } catch ( err1 ) { // Didn't *look* valid to qSA, warn and try quoting what we think is the value @@ -126,7 +151,7 @@ jQuery.find = function( selector ) { // If the regexp *may* have created an invalid selector, don't update it // Note that there may be false alarms if selector uses jQuery extensions try { - document.querySelector( selector ); + window.document.querySelector( selector ); migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] ); args[ 0 ] = selector; } catch ( err2 ) { @@ -148,7 +173,7 @@ for ( findProp in oldFind ) { // The number of elements contained in the matched element set jQuery.fn.size = function() { - migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" ); + migrateWarn( "jQuery.fn.size() is deprecated and removed; use the .length property" ); return this.length; }; @@ -175,14 +200,17 @@ jQuery.isNumeric = function( val ) { return oldValue; }; -migrateWarnProp( jQuery, "unique", jQuery.uniqueSort, - "jQuery.unique is deprecated, use jQuery.uniqueSort" ); +migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady, + "jQuery.holdReady is deprecated" ); + +migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort, + "jQuery.unique is deprecated; use jQuery.uniqueSort" ); // Now jQuery.expr.pseudos is the standard incantation migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos, - "jQuery.expr.filters is now jQuery.expr.pseudos" ); + "jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" ); migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos, - "jQuery.expr[\":\"] is now jQuery.expr.pseudos" ); + "jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" ); var oldAjax = jQuery.ajax; @@ -192,11 +220,11 @@ jQuery.ajax = function( ) { // Be sure we got a jQXHR (e.g., not sync) if ( jQXHR.promise ) { - migrateWarnProp( jQXHR, "success", jQXHR.done, + migrateWarnFunc( jQXHR, "success", jQXHR.done, "jQXHR.success is deprecated and removed" ); - migrateWarnProp( jQXHR, "error", jQXHR.fail, + migrateWarnFunc( jQXHR, "error", jQXHR.fail, "jQXHR.error is deprecated and removed" ); - migrateWarnProp( jQXHR, "complete", jQXHR.always, + migrateWarnFunc( jQXHR, "complete", jQXHR.always, "jQXHR.complete is deprecated and removed" ); } @@ -302,8 +330,26 @@ var oldData = jQuery.data; jQuery.data = function( elem, name, value ) { var curData; + // Name can be an object, and each entry in the object is meant to be set as data + if ( name && typeof name === "object" && arguments.length === 2 ) { + curData = jQuery.hasData( elem ) && oldData.call( this, elem ); + var sameKeys = {}; + for ( var key in name ) { + if ( key !== jQuery.camelCase( key ) ) { + migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key ); + curData[ key ] = name[ key ]; + } else { + sameKeys[ key ] = name[ key ]; + } + } + + oldData.call( this, elem, sameKeys ); + + return name; + } + // If the name is transformed, look for the un-transformed name in the data object - if ( name && name !== jQuery.camelCase( name ) ) { + if ( name && typeof name === "string" && name !== jQuery.camelCase( name ) ) { curData = jQuery.hasData( elem ) && oldData.call( this, elem ); if ( curData && name in curData ) { migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name ); @@ -318,30 +364,41 @@ jQuery.data = function( elem, name, value ) { }; var oldTweenRun = jQuery.Tween.prototype.run; +var linearEasing = function( pct ) { + return pct; + }; -jQuery.Tween.prototype.run = function( percent ) { +jQuery.Tween.prototype.run = function( ) { if ( jQuery.easing[ this.easing ].length > 1 ) { migrateWarn( - "easing function " + - "\"jQuery.easing." + this.easing.toString() + - "\" should use only first argument" + "'jQuery.easing." + this.easing.toString() + "' should use only one argument" ); - jQuery.easing[ this.easing ] = jQuery.easing[ this.easing ].bind( - jQuery.easing, - percent, this.options.duration * percent, 0, 1, this.options.duration - ); + jQuery.easing[ this.easing ] = linearEasing; } oldTweenRun.apply( this, arguments ); }; +jQuery.fx.interval = jQuery.fx.interval || 13; + +// Support: IE9, Android <=4.4 +// Avoid false positives on browsers that lack rAF +if ( window.requestAnimationFrame ) { + migrateWarnProp( jQuery.fx, "interval", jQuery.fx.interval, + "jQuery.fx.interval is deprecated" ); +} + var oldLoad = jQuery.fn.load, + oldEventAdd = jQuery.event.add, originalFix = jQuery.event.fix; jQuery.event.props = []; jQuery.event.fixHooks = {}; +migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat, + "jQuery.event.props.concat() is deprecated and removed" ); + jQuery.event.fix = function( originalEvent ) { var event, type = originalEvent.type, @@ -360,7 +417,7 @@ jQuery.event.fix = function( originalEvent ) { migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type ); if ( ( props = fixHook.props ) && props.length ) { while ( props.length ) { - jQuery.event.addProp( props.pop() ); + jQuery.event.addProp( props.pop() ); } } } @@ -370,6 +427,15 @@ jQuery.event.fix = function( originalEvent ) { return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }; +jQuery.event.add = function( elem, types ) { + + // This misses the multiple-types case but that seems awfully rare + if ( elem === window && types === "load" && window.document.readyState === "complete" ) { + migrateWarn( "jQuery(window).on('load'...) called after load event occurred" ); + } + return oldEventAdd.apply( this, arguments ); +}; + jQuery.each( [ "load", "unload", "error" ], function( _, name ) { jQuery.fn[ name ] = function() { @@ -400,14 +466,28 @@ jQuery.each( [ "load", "unload", "error" ], function( _, name ) { } ); +jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup contextmenu" ).split( " " ), + function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" ); + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; +} ); + // Trigger "ready" event only once, on document ready jQuery( function() { - jQuery( document ).triggerHandler( "ready" ); + jQuery( window.document ).triggerHandler( "ready" ); } ); jQuery.event.special.ready = { setup: function() { - if ( this === document ) { + if ( this === window.document ) { migrateWarn( "'ready' event is deprecated" ); } } @@ -432,6 +512,10 @@ jQuery.fn.extend( { return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + hover: function( fnOver, fnOut ) { + migrateWarn( "jQuery.fn.hover() is deprecated" ); + return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver ); } } ); @@ -448,7 +532,7 @@ jQuery.fn.offset = function() { return origin; } - docElem = ( elem.ownerDocument || document ).documentElement; + docElem = ( elem.ownerDocument || window.document ).documentElement; if ( !jQuery.contains( docElem, elem ) ) { migrateWarn( "jQuery.fn.offset() requires an element connected to a document" ); return origin; @@ -475,7 +559,7 @@ jQuery.param = function( data, traditional ) { var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack; jQuery.fn.andSelf = function() { - migrateWarn( "jQuery.fn.andSelf() replaced by jQuery.fn.addBack()" ); + migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" ); return oldSelf.apply( this, arguments ); }; @@ -535,6 +619,8 @@ jQuery.Deferred = function( func ) { return deferred; }; +// Preserve handler of uncaught exceptions in promise chains +jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook; - -})( jQuery, window ); +return jQuery; +} ); diff --git a/libraries/classes/Header.php b/libraries/classes/Header.php index 5e80257209..20e78c9ce5 100644 --- a/libraries/classes/Header.php +++ b/libraries/classes/Header.php @@ -156,7 +156,7 @@ class Header { // Localised strings $this->_scripts->addFile('vendor/jquery/jquery.min.js'); - $this->_scripts->addFile('vendor/jquery/jquery-migrate-3.0.0.js'); + $this->_scripts->addFile('vendor/jquery/jquery-migrate.js'); $this->_scripts->addFile('whitelist.php'); $this->_scripts->addFile('vendor/sprintf.js'); $this->_scripts->addFile('ajax.js'); diff --git a/package.json b/package.json index 1838797f64..d82bec3766 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dependencies": { "codemirror": "5.30.0", "jquery": "3.2.1", - "jquery-migrate": "3.0.0", + "jquery-migrate": "3.0.1", "jquery-mousewheel": "3.1.13", "jquery-ui": "1.12.1", "jquery-ui-timepicker-addon": "1.6.3", diff --git a/yarn.lock b/yarn.lock index 90e1e3f232..11f8ce21af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -454,9 +454,9 @@ isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" -jquery-migrate@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/jquery-migrate/-/jquery-migrate-3.0.0.tgz#03f320596fe1a1db09cdcfb74b14571994aad7bb" +jquery-migrate@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/jquery-migrate/-/jquery-migrate-3.0.1.tgz#141de3abfe6d301baaa4130b0ec7b9a839845e72" jquery-mousewheel@3.1.13: version "3.1.13"