Skip to main content

Search and Top Navigation

#15152 closed bug (fixed)

Opened March 16, 2017 12:05PM UTC

Closed April 19, 2017 04:54PM UTC

Last modified April 19, 2017 04:56PM UTC

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

Reported by: AlexShinkin Owned by: scottgonzalez
Priority: minor Milestone: 1.12.2
Component: ui.selectmenu Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:
Description

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

Attachments (0)
Change History (4)

Changed March 16, 2017 12:06PM UTC by AlexShinkin comment:1

description: 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 do ) cause general slow downs due to memory/cpu starvation. \ \ Regards, \ Alex 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

Changed March 17, 2017 02:46AM UTC by AlexShinkin comment:2

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 .

Changed April 19, 2017 04:54PM UTC by scottgonzalez comment:3

owner: → scottgonzalez
resolution: → fixed
status: newclosed

In [changeset:"ef2e9bab92ae898311baa295590cd487d9071319" ef2e9ba]:

#!CommitTicketReference repository="" revision="ef2e9bab92ae898311baa295590cd487d9071319"
Widget: Improve  event bindings for  options

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

Changed April 19, 2017 04:56PM UTC by scottgonzalez comment:4

milestone: none1.12.2