forked from bigcommerce/cornerstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STRF-5732: Get rid of jquery-migrate
* We only need a small subset of jquery-migrate (to support Foundation 5.5), so pull that in directly rather than the whole library
- Loading branch information
Showing
5 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// From https://github.com/jquery/jquery-migrate/blob/master/src/event.js | ||
// Needed because we use Foundation 5.5, which expects jQuery 2.x. However, | ||
// rather than bringing in all of jquery-migrate, we're cherry picking individual | ||
// fixes needed for Foundation. | ||
// | ||
// See https://stackoverflow.com/questions/37738732/jquery-3-0-url-indexof-error/37915907#37915907 | ||
// | ||
jQuery.each( [ "load", "unload", "error" ], function( _, name ) { | ||
|
||
jQuery.fn[ name ] = function() { | ||
var args = Array.prototype.slice.call( arguments, 0 ); | ||
|
||
// If this is an ajax load() the first arg should be the string URL; | ||
// technically this could also be the "Anything" arg of the event .load() | ||
// which just goes to show why this dumb signature has been deprecated! | ||
// jQuery custom builds that exclude the Ajax module justifiably die here. | ||
if ( name === "load" && typeof args[ 0 ] === "string" ) { | ||
return oldLoad.apply( this, args ); | ||
} | ||
|
||
args.splice( 0, 0, name ); | ||
if ( arguments.length ) { | ||
return this.on.apply( this, args ); | ||
} | ||
|
||
// Use .triggerHandler here because: | ||
// - load and unload events don't need to bubble, only applied to window or image | ||
// - error event should not bubble to window, although it does pre-1.7 | ||
// See http://bugs.jquery.com/ticket/11820 | ||
this.triggerHandler.apply( this, args ); | ||
return this; | ||
}; | ||
|
||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters