Opened 3 years ago

Last modified 2 years ago

#15082 closed bug

jQuery Autocomplete Duplicate Remove event listener — at Initial Version

Reported by: jGeek314 Owned by:
Priority: minor Milestone: 1.12.2
Component: ui.autocomplete Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:

Description

While trying to determine what was slowing down my autocomplete text box, I noticed that every time the user types in the target text box the number of event listeners would go up. It looks like autocomplete (or the widget factory?) is adding duplicate "remove" events to the target. This can be reproduced by adding the following line to the default autocomplete example at https://jqueryui.com/autocomplete/ .

response: function (e, ui) {
        console.log( jQuery._data( $("#tags")[0], "events" ) );
      }

When looking at the results in chrome's developer tools I can see the number of event listeners go up every time the the user types in the target text box.

Object {remove: Array[3], keydown: Array[1], keypress: Array[1], input: Array[1]...
Object {remove: Array[5], keydown: Array[1], keypress: Array[1], input: Array[1]...
Object {remove: Array[7], keydown: Array[1], keypress: Array[1], input: Array[1]...
Object {remove: Array[9], keydown: Array[1], keypress: Array[1], input: Array[1]...

http://plnkr.co/edit/Jk2xg3ZjJ5jS5mgP1zHZ?p=preview is a demo of the remove events growing.

Change History (0)

Note: See TracTickets for help on using tickets.