jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/371511 )
Change subject: Fix JQMIGRATE warnings in jQuery Mobile ...................................................................... Fix JQMIGRATE warnings in jQuery Mobile jQuery Mobile 1.5 is supposed to be compatible with jQuery 3, but it isn't... * Replace .bind() calls with .on() * Replace .unbind() calls with .off() Bug: T165816 Change-Id: I79639fd9ae8e6e785f93191273147866e52c4ed1 --- M resources/libraries/jquery.mobile.custom.js 1 file changed, 30 insertions(+), 26 deletions(-) Approvals: jenkins-bot: Verified Isarra: Looks good to me, approved diff --git a/resources/libraries/jquery.mobile.custom.js b/resources/libraries/jquery.mobile.custom.js index 376d183..bb1353f 100644 --- a/resources/libraries/jquery.mobile.custom.js +++ b/resources/libraries/jquery.mobile.custom.js @@ -1,3 +1,7 @@ +// Custom hacks: +// * Replaced .bind() calls with .on() for compatibility with jQuery 3 +// * Replaced .unbind() calls with .off() for compatibility with jQuery 3 + /* * jQuery Mobile v1.4.5 * http://jquerymobile.com @@ -366,14 +370,14 @@ activeDocHandlers[ eventType ] = ( activeDocHandlers[ eventType ] || 0 ) + 1; if ( activeDocHandlers[ eventType ] === 1 ) { - $document.bind( realType, mouseEventCallback ); + $document.on( realType, mouseEventCallback ); } // Some browsers, like Opera Mini, won't dispatch mouse/click events // for elements unless they actually have handlers registered on them. // To get around this, we register dummy handlers on the elements. - $( this ).bind( realType, dummyMouseHandler ); + $( this ).on( realType, dummyMouseHandler ); // For now, if event capture is not supported, we rely on mouse handlers. if ( eventCaptureSupported ) { @@ -383,8 +387,8 @@ activeDocHandlers[ "touchstart" ] = ( activeDocHandlers[ "touchstart" ] || 0) + 1; if ( activeDocHandlers[ "touchstart" ] === 1 ) { - $document.bind( "touchstart", handleTouchStart ) - .bind( "touchend", handleTouchEnd ) + $document.on( "touchstart", handleTouchStart ) + .on( "touchend", handleTouchEnd ) // On touch platforms, touching the screen and then dragging your finger // causes the window content to scroll after some distance threshold is @@ -396,8 +400,8 @@ // we need to watch both scroll and touchmove events to figure out whether // or not a scroll happenens before the touchend event is fired. - .bind( "touchmove", handleTouchMove ) - .bind( "scroll", handleScroll ); + .on( "touchmove", handleTouchMove ) + .on( "scroll", handleScroll ); } } }, @@ -409,7 +413,7 @@ --activeDocHandlers[ eventType ]; if ( !activeDocHandlers[ eventType ] ) { - $document.unbind( realType, mouseEventCallback ); + $document.off( realType, mouseEventCallback ); } if ( eventCaptureSupported ) { @@ -419,10 +423,10 @@ --activeDocHandlers[ "touchstart" ]; if ( !activeDocHandlers[ "touchstart" ] ) { - $document.unbind( "touchstart", handleTouchStart ) - .unbind( "touchmove", handleTouchMove ) - .unbind( "touchend", handleTouchEnd ) - .unbind( "scroll", handleScroll ); + $document.off( "touchstart", handleTouchStart ) + .off( "touchmove", handleTouchMove ) + .off( "touchend", handleTouchEnd ) + .off( "scroll", handleScroll ); } } @@ -440,7 +444,7 @@ // Unregister the dummy event handler. - $this.unbind( realType, dummyMouseHandler ); + $this.off( realType, dummyMouseHandler ); // If this is the last virtual mouse binding on the // element, remove the binding data from the element. @@ -552,7 +556,7 @@ "scrollstart scrollstop" ).split( " " ), function( i, name ) { $.fn[ name ] = function( fn ) { - return fn ? this.bind( name, fn ) : this.trigger( name ); + return fn ? this.on( name, fn ) : this.trigger( name ); }; // jQuery < 1.8 @@ -589,7 +593,7 @@ } // iPhone triggers scroll after a small delay; use touchmove instead - $this.bind( scrollEvent, function( event ) { + $this.on( scrollEvent, function( event ) { if ( !$.event.special.scrollstart.enabled ) { return; @@ -606,7 +610,7 @@ }); }, teardown: function() { - $( this ).unbind( scrollEvent ); + $( this ).off( scrollEvent ); } }; @@ -619,7 +623,7 @@ $this = $( thisObject ), isTaphold = false; - $this.bind( "vmousedown", function( event ) { + $this.on( "vmousedown", function( event ) { isTaphold = false; if ( event.which && event.which !== 1 ) { return false; @@ -635,9 +639,9 @@ function clearTapHandlers() { clearTapTimer(); - $this.unbind( "vclick", clickHandler ) - .unbind( "vmouseup", clearTapTimer ); - $document.unbind( "vmousecancel", clearTapHandlers ); + $this.off( "vclick", clickHandler ) + .off( "vmouseup", clearTapTimer ); + $document.off( "vmousecancel", clearTapHandlers ); } function clickHandler( event ) { @@ -652,9 +656,9 @@ } } - $this.bind( "vmouseup", clearTapTimer ) - .bind( "vclick", clickHandler ); - $document.bind( "vmousecancel", clearTapHandlers ); + $this.on( "vmouseup", clearTapTimer ) + .on( "vclick", clickHandler ); + $document.on( "vmousecancel", clearTapHandlers ); timer = setTimeout( function() { if ( !$.event.special.tap.emitTapOnTaphold ) { @@ -665,8 +669,8 @@ }); }, teardown: function() { - $( this ).unbind( "vmousedown" ).unbind( "vclick" ).unbind( "vmouseup" ); - $document.unbind( "vmousecancel" ); + $( this ).off( "vmousedown" ).off( "vclick" ).off( "vmouseup" ); + $document.off( "vmousecancel" ); } }; @@ -850,10 +854,10 @@ $.event.special[ event ] = { setup: function() { - $( this ).bind( sourceEvent, $.noop ); + $( this ).on( sourceEvent, $.noop ); }, teardown: function() { - $( this ).unbind( sourceEvent ); + $( this ).off( sourceEvent ); } }; }); -- To view, visit https://gerrit.wikimedia.org/r/371511 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I79639fd9ae8e6e785f93191273147866e52c4ed1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/Timeless Gerrit-Branch: master Gerrit-Owner: Bartosz DziewoĆski <[email protected]> Gerrit-Reviewer: Isarra <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
