Opened 21 months ago

Closed 20 months ago

Last modified 20 months ago

#15152 closed bug (fixed)

Selectmenu: incorrect 'remove' event handler management for selectmenu button

Reported by: AlexShinkin Owned by: Scott González
Priority: minor Milestone: 1.12.2
Component: ui.selectmenu Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by AlexShinkin)

Might be related to #15078

When a selectmenu is initialised , an internally used <span> section is created that contain button , icon and text.

Each of the components has a set of event listeners .

The bug is - after any activity on a selectmenu ( such as selecting options, just clicking on the menu button a few times, calling .selectmenu("refresh") ) a bunch of 'remove' event handlers gets added to the the selectmenu button.

Looks like the number of the added handlers is equal to the number of menu options. I.e. if a selectmenu has 10 options , clicking on a menu 3 times adds 30 identical handlers to the menu button.

Observed with jQueryUI 1.12.1 and jQuery 1.12.4 and 3.1.1

Easy to reproduce - just load an example page ( like http://jqueryui.com/selectmenu ) , click the selectmenu button a few times , then inspect the button event handlers list .

May ( and most likely does ) cause general slow downs due to memory/cpu starvation.

Regards, Alex

Change History (4)

comment:1 Changed 21 months ago by AlexShinkin

Description: modified (diff)

comment:2 Changed 21 months ago by AlexShinkin

Update:

no , there is dependency on the number of menu options . Looks like 2 handlers get added each time the button re-rendered ?

Initially , after calling .selectmenu() the button has 2 'remove' handlers attached. Calling selectmenu("refresh") adds 2 handlers. Clicking a menu button adds 2 handlers , selecting of an option adds another 2 handlers .

comment:3 Changed 20 months ago by Scott González

Owner: set to Scott González
Resolution: fixed
Status: newclosed

In ef2e9ba:

Widget: Improve remove event bindings for classes options

Fixes #15078
Fixes #15082
Fixes #15095
Fixes #15136
Fixes #15152
Closes gh-1769

comment:4 Changed 20 months ago by Scott González

Milestone: none1.12.2
Note: See TracTickets for help on using tickets.