Make WordPress Core

Opened 8 weeks ago

Last modified 6 weeks ago

#64425 new defect (bug)

JQuery .proxy deprecated and QMIGRATE: Boolean attribute 'disabled' is not set to its lowercased name in Jquery 4.0

Reported by: neo2k23's profile neo2k23 Owned by:
Milestone: 7.0 Priority: normal
Severity: normal Version: trunk
Component: General Keywords: has-patch
Focuses: Cc:

Description

Hi

I am using the latest Test jQuery Updates plugin to test jquery 4.0 and i get the following jquery migrate warnings when trying to insert a image from the media library in a plugin setting.

		JQMIGRATE: jQuery.proxy() is deprecated jquery-migrate-4.0.0-beta.1.js:136:28
		console.trace() JQMIGRATE: jQuery.proxy() is deprecated jquery-migrate-4.0.0-beta.1.js:142:13
			jQuery 3
			Uploader http://server.tst/wp-includes/js/plupload/wp-plupload.js?ver=7.0-alpha-61387:74
			ready http://server.tst/wp-includes/js/media-views.js?ver=7.0-alpha-61387:9608

and this one.

		console.trace() JQMIGRATE: Boolean attribute 'disabled' is not set to its lowercased name jquery-migrate-4.0.0-beta.1.js:142:13
			jQuery 8
			render http://server.tst/wp-includes/js/media-views.js?ver=7.0-alpha-61387:1337
			Backbone 5
			refresh http://server.tst/wp-includes/js/media-views.js?ver=7.0-

Please fix. Thank you

Change History (6)

#1 @neo2k23
8 weeks ago

I found one fix

changing line 1337 and line 5794 in media-views.js from attr to prop fixes that warning message.

    this.$el.prop( 'disabled', model.disabled );

changing line 74 in wp-upload.js to

	this[ key ] = this[ key ].bind( this );

fixes the .proxy warning but i am not sure that is the correct fix as .bind does not set guid on the bound function instances so that proxied event handlers can be removed without storing the instance of the proxied function.

Last edited 8 weeks ago by neo2k23 (previous) (diff)

#2 @azaozz
7 weeks ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 7.0

Replacing attr with prop should be straightforward. Thinking many of these were fixed earlier but seems there are more places where this is needed.

Not completely sure about $.proxy too. Needs more testing.

This ticket was mentioned in PR #10661 on WordPress/wordpress-develop by @hbhalodia.


7 weeks ago
#3

  • Keywords has-patch added; needs-patch removed

Trac ticket: https://core.trac.wordpress.org/ticket/64425

  • Updated attr to use prop.
  • Use bind instead of proxy with a comment to update the function used with namespace.

#4 @hbhalodia
7 weeks ago

Hi @neo2k23 @azaozz, I have added the PR for the same. As said, we need to test the bind related changes, because we do not know in what context it the function can be instantiated.

Thanks,

#5 follow-up: @neo2k23
7 weeks ago

@hbhalodia @azaozz i scanned the current beta version wp 7 for all .proxy instances and there are in total 4 files using .proxy

https://share.zight.com/jkuNXqA8

medialeement-and-player.js
tinymce.min.js
wp-upload.js
wp-tinymce.js

It was already clear to me that just replacing .proxy with .bind could cause issues as .bind does not set guid on the bound function instances so that proxied event handlers can be removed without storing the instance of the proxied function.

Thanks all and have a great XMas.

#6 in reply to: ↑ 5 @azaozz
6 weeks ago

Replying to neo2k23:

medialeement-and-player.js
tinymce.min.js
wp-upload.js
wp-tinymce.js

Most of these are (older) external libraries, not sure if they can be/should be patched by WP. At the same time it seems there aren't plans upstream to remove support for $.proxy for now, so can probably leave it as-is. Can fix wp-upload.js though.

Thanks all and have a great XMas.

Thanks, you too!

Last edited 6 weeks ago by azaozz (previous) (diff)
Note: See TracTickets for help on using tickets.