From eaadcc0eebcd6ea45523e19f79b042dc0d6a30bb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 24 Oct 2012 12:00:03 -0400 Subject: [PATCH] Widget: Bind the remove event to the element, not the .widget() element. --- ui/jquery.ui.autocomplete.js | 3 ++- ui/jquery.ui.widget.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 7bacca006..2d064834c 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -64,7 +64,7 @@ $.widget( "ui.autocomplete", { .addClass( "ui-autocomplete-input" ) .attr( "autocomplete", "off" ); - this._on({ + this._on( this.element, { keydown: function( event ) { if ( this.element.prop( "readOnly" ) ) { suppressKeyPress = true; @@ -191,6 +191,7 @@ $.widget( "ui.autocomplete", { .zIndex( this.element.zIndex() + 1 ) .hide() .data( "menu" ); + this._on( this.menu.element, { mousedown: function( event ) { // prevent moving focus out of the text field diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index a6eae6580..f4805fb75 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -237,7 +237,7 @@ $.Widget.prototype = { // TODO remove dual storage $.data( element, this.widgetName, this ); $.data( element, this.widgetFullName, this ); - this._on({ + this._on( this.element, { remove: function( event ) { if ( event.target === element ) { this.destroy(); -- 2.39.5