Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Correctly detach events when AutoCompleteList is destroyed. [Fixes #2…

…532419]
  • Loading branch information...
commit eebae57be43d0ccaf59a632f1df7a8f04cf5e9ba 1 parent 178429c
@rgrove rgrove authored
View
4 src/autocomplete/HISTORY.md
@@ -4,7 +4,9 @@ AutoComplete Change History
3.6.0
-----
-* No changes.
+* Fixed an issue that prevented events from being detached when the AutoComplete
+ widget was destroyed. [Ticket #2532419]
+
3.5.1
-----
View
4 src/autocomplete/js/autocomplete-list.js
@@ -328,7 +328,7 @@ List = Y.Base.create('autocompleteList', Y.Widget, [
}
// Attach inputNode events.
- this._listEvents.concat([
+ this._listEvents = this._listEvents.concat([
inputNode.after('blur', this._afterListInputBlur, this),
inputNode.after('focus', this._afterListInputFocus, this)
]);
@@ -341,7 +341,7 @@ List = Y.Base.create('autocompleteList', Y.Widget, [
@protected
**/
_bindList: function () {
- this._listEvents.concat([
+ this._listEvents = this._listEvents.concat([
Y.one('doc').after('click', this._afterDocClick, this),
Y.one('win').after('windowresize', this._syncPosition, this),
View
9 src/autocomplete/tests/functional/autocomplete-test.js
@@ -1672,6 +1672,15 @@ listSuite.add(new Y.Test.Case({
this.ac.selectItem(items.item(0));
Assert.areSame(1, fired);
+ },
+
+ 'list events should be detached when the list is destroyed': function () {
+ this.ac.render();
+
+ Assert.isTrue(this.ac._listEvents.length > 0);
+ this.ac.destroy();
+ Assert.areSame(0, this.ac._listEvents.length);
+
}
}));
Please sign in to comment.
Something went wrong with that request. Please try again.