Skip to content

Deferred: Don't warn on setting getStackHook to the getErrorHook value #577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

mgol
Copy link
Member

@mgol mgol commented Apr 28, 2025

4.x version of #578

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 gh-578

@mgol mgol added this to the 4.0.0 milestone Apr 28, 2025
@mgol mgol self-assigned this Apr 28, 2025
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
@mgol
Copy link
Member Author

mgol commented Apr 28, 2025

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;
}

@mgol mgol added the Discuss in Meeting Reserved for Issues and PRs that anyone would like to discuss in the weekly meeting. label Apr 28, 2025
@timmywil timmywil removed Discuss in Meeting Reserved for Issues and PRs that anyone would like to discuss in the weekly meeting. Needs review labels Apr 28, 2025
mgol added a commit 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`.

Closes gh-578
Ref gh-577
@mgol mgol merged commit 94fbdb3 into jquery:main Apr 28, 2025
13 checks passed
@mgol mgol deleted the getStackHook branch April 28, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants