Store event handler proxy for size change

Workaround for bug 63094.

Change-Id: I91855802486cd25e7109cad7d656eb40f6a3580c
This commit is contained in:
Gergő Tisza 2014-03-26 01:33:38 +00:00
parent 91c4fcbca4
commit 41bc451d87

View file

@ -253,9 +253,12 @@
// Register handler for switching between wikitext/html snippets
this.embedSwitch.on( 'select', $.proxy( embed.handleTypeSwitch, embed ) );
// workaround for bug 63094
this.proxiedHandleSizeSwitch = this.proxiedHandleSizeSwitch || $.proxy( this.handleSizeSwitch, this );
// Register handlers for switching between file sizes
this.embedHtmlSizeSwitch.getMenu().on( 'select', $.proxy( embed.handleSizeSwitch, embed ) );
this.embedWtSizeSwitch.getMenu().on( 'select', $.proxy( embed.handleSizeSwitch, embed ) );
this.embedHtmlSizeSwitch.getMenu().on( 'select', this.proxiedHandleSizeSwitch );
this.embedWtSizeSwitch.getMenu().on( 'select', this.proxiedHandleSizeSwitch );
};
/**
@ -267,8 +270,9 @@
this.embedTextHtml.offDOMEvent( 'focus mousedown click' );
this.embedTextWikitext.offDOMEvent( 'focus mousedown click' );
this.embedSwitch.off( 'select' );
this.embedHtmlSizeSwitch.getMenu().off( 'select' );
this.embedWtSizeSwitch.getMenu().off( 'select' );
// the noop is needed for some tests which call unattach before calling attach.
this.embedHtmlSizeSwitch.getMenu().off( 'select', this.proxiedHandleSizeSwitch || $.noop );
this.embedWtSizeSwitch.getMenu().off( 'select', this.proxiedHandleSizeSwitch || $.noop );
};
/**