Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372494 )

Change subject: Update jQuery Migrate to v3.0.1-pre (9e3dfcb)
......................................................................

Update jQuery Migrate to v3.0.1-pre (9e3dfcb)

Highlights:

* Event: Warn and fill jQuery.event.props.concat
  > Adds back-compat for a removed property. (Undocumented)
  > This makes jQuery 3 compatible with jQuery Mobile pre-1.5

* Effects: Warn on use of jQuery.fx.interval
  > Adds detection for a deprecated property.

* Event: Warn about late use of $(window).on("load"...)

* Data: Fix support for object as second argument
  > Fixes minor regression that jQuery Migrate introduced
  > over jQuery 3.0 plain.

* Docs: Clarify wording around deprecated/removed methods
  > Avoids confusion between whether a method was removed
  > in jQuery 3, or merely deprecated.

Full change log:
https://github.com/jquery/jquery-migrate/compare/3.0.0...9e3dfcb

Also re-apply and document hot patch from a77525e56ac1a.

Bug: T124742
Change-Id: Ia55b6aad1648667648cc511eddea12b808d7e898
---
M resources/lib/jquery/jquery.migrate.js
1 file changed, 102 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/94/372494/1

diff --git a/resources/lib/jquery/jquery.migrate.js 
b/resources/lib/jquery/jquery.migrate.js
index 879509f..f094aaa 100644
--- a/resources/lib/jquery/jquery.migrate.js
+++ b/resources/lib/jquery/jquery.migrate.js
@@ -1,13 +1,34 @@
 /*!
- * jQuery Migrate - v3.0.0 - 2016-06-09
+ * jQuery Migrate - v3.0.1-pre - 2017-08-17
  * Copyright jQuery Foundation and other contributors
+ *
+ * Patched for MediaWiki:
+ * - Preserve handler of uncaught exceptions in promise chains
+ *   https://gerrit.wikimedia.org/r/#/c/360999/
+ *   https://github.com/jquery/jquery-migrate/pull/262
  */
-(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-pre";
 
+/* exported migrateWarn, migrateWarnFunc, migrateWarnProp */
 
 ( function() {
 
@@ -15,7 +36,9 @@
        // 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 ); },
+               function() {
+                       window.console.log.apply( window.console, arguments );
+               },
                rbadVersions = /^[12]\./;
 
        if ( !log ) {
@@ -74,11 +97,22 @@
                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 +149,7 @@
                // 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 +160,7 @@
                        // 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 +182,7 @@
 
 // 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 +209,14 @@
        return oldValue;
 };
 
-migrateWarnProp( jQuery, "unique", jQuery.uniqueSort,
-       "jQuery.unique is deprecated, use jQuery.uniqueSort" );
+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 +226,11 @@
 
        // 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 +336,26 @@
 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 );
@@ -319,7 +371,7 @@
 
 var oldTweenRun = jQuery.Tween.prototype.run;
 
-jQuery.Tween.prototype.run = function( percent ) {
+jQuery.Tween.prototype.run = function( ) {
        if ( jQuery.easing[ this.easing ].length > 1 ) {
                migrateWarn(
                        "easing function " +
@@ -327,20 +379,33 @@
                        "\" should use only first argument"
                );
 
-               jQuery.easing[ this.easing ] = jQuery.easing[ this.easing 
].bind(
-                       jQuery.easing,
-                       percent, this.options.duration * percent, 0, 1, 
this.options.duration
-               );
+               var oldEasing = jQuery.easing[ this.easing ];
+               jQuery.easing[ this.easing ] = function( percent ) {
+                       return oldEasing.call( jQuery.easing, percent, percent, 
0, 1, 1 );
+               }.bind( this );
        }
 
        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,
@@ -360,7 +425,7 @@
                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() );
                        }
                }
        }
@@ -368,6 +433,15 @@
        event = originalFix.call( this, 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 ) {
@@ -402,12 +476,12 @@
 
 // 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" );
                }
        }
@@ -448,7 +522,7 @@
                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 +549,7 @@
 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 );
 };
 
@@ -538,5 +612,5 @@
 // Preserve handler of uncaught exceptions in promise chains
 jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
 
-
-})( jQuery, window );
+return jQuery;
+} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia55b6aad1648667648cc511eddea12b808d7e898
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to