Replace jQuery.proxy() with Function.prototype.bind()

Also, one immediate invocation of jQuery.proxy() is replaced by
Function.prototype.call()

Change-Id: Ibbdbe6413793c113d4de1c67cfcb7d95676565b2
This commit is contained in:
petarpetkovic
2018-05-24 19:09:31 +02:00
committed by jenkins-bot
parent c300951890
commit 9c0c918bab
3 changed files with 20 additions and 20 deletions

View File

@@ -74,14 +74,14 @@
// Register all event listeners to the ULS language settings here.
listen: function () {
this.$element.on( 'click', $.proxy( this.click, this ) );
this.$element.on( 'click', this.click.bind( this ) );
this.$window.find( '#languagesettings-close, button.uls-settings-cancel' )
.on( 'click', $.proxy( mw.hook( 'mw.uls.settings.cancel' ).fire, this ) );
.on( 'click', mw.hook( 'mw.uls.settings.cancel' ).fire.bind( this ) );
this.$window.find( 'button.uls-settings-apply' )
.on( 'click', $.proxy( mw.hook( 'mw.uls.settings.apply' ).fire, this ) );
.on( 'click', mw.hook( 'mw.uls.settings.apply' ).fire.bind( this ) );
// Hide the window when clicked outside
$( 'html' ).click( $.proxy( this.hide, this ) );
$( 'html' ).click( this.hide.bind( this ) );
// ... but when clicked on window do not hide.
this.$window.on( 'click', function ( event ) {
@@ -168,8 +168,8 @@
this.modules[ moduleName ] = module;
// Register cancel and apply hooks
mw.hook( 'mw.uls.settings.cancel' ).add( $.proxy( module.cancel, module ) );
mw.hook( 'mw.uls.settings.apply' ).add( $.proxy( module.apply, module ) );
mw.hook( 'mw.uls.settings.cancel' ).add( module.cancel.bind( module ) );
mw.hook( 'mw.uls.settings.apply' ).add( module.apply.bind( module ) );
},
position: function () {