Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/js/_enqueues/vendor/plupload/wp-plupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,20 @@ window.wp = window.wp || {};
*/
$.extend( true, this, options );

// Proxy all methods so this always refers to the current instance.
/*
* Bind all methods so this always refers to the current instance.
* Note: Using .bind() creates new function references. If these bound functions
* are used with jQuery event handlers, be aware that jQuery's event subsystem
* tracks functions by reference. The bound function will be seen as a single
* function even when binding different contexts, which can make unbinding
* specific handlers difficult. Use unique event namespaces (e.g., 'click.myproxy1')
* when binding and unbinding to avoid removing the wrong handler.
*
* Ref - https://api.jquery.com/jQuery.proxy/
*/
for ( key in this ) {
if ( typeof this[ key ] === 'function' ) {
this[ key ] = $.proxy( this[ key ], this );
this[ key ] = this[ key ].bind( this );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/media/controllers/cropper.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Cropper = wp.media.controller.State.extend(/** @lends wp.media.controller.Croppe
selection.set({cropDetails: controller.state().imgSelect.getSelection()});

this.$el.text(l10n.cropping);
this.$el.attr('disabled', true);
this.$el.prop( 'disabled', true );

controller.state().doCrop( selection ).done( function( croppedImage ) {
controller.trigger('cropped', croppedImage );
Expand Down
2 changes: 1 addition & 1 deletion src/js/media/views/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var Button = wp.media.View.extend(/** @lends wp.media.view.Button.prototype */{
classes = _.uniq( classes.concat( this.options.classes ) );
this.el.className = classes.join(' ');

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

return this;
Expand Down
Loading