Deferred: Don't warn on setting getStackHook to the getErrorHook value#577
Merged
mgol merged 1 commit intojquery:mainfrom Apr 28, 2025
Merged
Deferred: Don't warn on setting getStackHook to the getErrorHook value#577mgol merged 1 commit intojquery:mainfrom
mgol merged 1 commit intojquery:mainfrom
Conversation
mgol
added a commit
to mgol/jquery-migrate
that referenced
this pull request
Apr 28, 2025
Don't warn if `jQuery.Deferred.getStackHook` is set to the value of `jQuery.Deferred.getErrorHook`. This is to facilitate plugins supporting both jQuery <3.7 and older without triggering Migrate warnings and without requiring complex logic parsing `jQuery.fn.jquery`. Ref jquerygh-577
mgol
added a commit
to mgol/jquery-migrate
that referenced
this pull request
Apr 28, 2025
Don't warn if `jQuery.Deferred.getStackHook` is set to the value of `jQuery.Deferred.getErrorHook`. This is to facilitate plugins supporting both jQuery <3.7 and older without triggering Migrate warnings and without requiring complex logic parsing `jQuery.fn.jquery`. Ref jquerygh-577
Don't warn if `jQuery.Deferred.getStackHook` is set to the value of `jQuery.Deferred.getErrorHook`. This is to facilitate plugins supporting both jQuery <3.7 and older without triggering Migrate warnings and without requiring complex logic parsing `jQuery.fn.jquery`. Ref jquerygh-578
Member
Author
|
For reference, this is what you currently have to do to avoid Migrate messages if you want to define hook in all versions where it's supported and you support both jQuery <3.7 and older: function getErrorHook() { /* ... */ }
var version = jQuery.fn.jquery
.split( "." )
.map( function( v ) {
return Number( v );
} );
if ( version[ 0 ] >= 4 || ( version[ 0 ] === 3 && version[ 1 ] >= 7 ) ) {
jQuery.Deferred.getErrorHook = getErrorHook;
} else {
jQuery.Deferred.getStackHook = getErrorHook;
} |
timmywil
approved these changes
Apr 28, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
4.x version of #578
Don't warn if
jQuery.Deferred.getStackHookis set to the value ofjQuery.Deferred.getErrorHook. This is to facilitate plugins supporting both jQuery <3.7 and older without triggering Migrate warnings and without requiring complex logic parsingjQuery.fn.jquery.Ref gh-578