Skip to content

Question - Why do methods like blur, focus, click, etc. generate warnings? #410

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

Closed
nestedsoftware opened this issue Jan 12, 2021 · 2 comments

Comments

@nestedsoftware
Copy link

Hi, I am hoping to get some clarification around why the following code is in the migrate plugin. Looking at the upgrade guide, I do not see any mention of any of these methods being deprecated. Likewise, they are nor marked as deprecated in the docs.

jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
	function( _i, name ) {

	// Handle event binding
	jQuery.fn[ name ] = function( data, fn ) {
		migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" );
		return arguments.length > 0 ?
			this.on( name, null, data, fn ) :
			this.trigger( name );
	};
} );
@mgol
Copy link
Member

mgol commented Jan 12, 2021

They were deprecated in 3.3.0 so they're not in a 3.0.0 upgrade guide.

See:
https://blog.jquery.com/2018/01/19/jquery-3-3-0-a-fragrant-bouquet-of-deprecations-and-is-that-a-new-feature/
which links to:
jquery/jquery#3214
and:
jquery/jquery@022b69a

We have a docs ticket at:
jquery/api.jquery.com#972
but it's not done yet (PRs welcome).

@mgol mgol closed this as completed Jan 12, 2021
@nestedsoftware
Copy link
Author

Thanks very much for the quick reply - much appreciated. I posted a follow-up question here - just hoping to understand more clearly whether this is something that could be removed in version 4... jquery/api.jquery.com#972 (comment)

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

No branches or pull requests

2 participants