Opened 20 months ago

Closed 17 months ago

Last modified 17 months ago

#15136 closed bug (fixed)

lots of duplicated events / memory leaks with tabs widget

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

Description

I've a lot of duplicated events and memory leaks with tabs widget.

An endless growing list of events like: "remove" on the tabs container "focusin", "mousedown" and "remove" on the tabs list ...

Some undesirable object references in "bindings", "classesElementLookup" ... which keep alive objects after a remove (memory leaks)

for example: in "tabs.js / function _processTabs", you setup tracked classes like this:

this._addClass( this.anchors, "ui-tabs-anchor" );

but, after in the function "_setupEvents", you get rid of all events with this :

this._off( this.anchors.add( this.tabs ).add( this.panels ) );

but in this case, the function "_untrackClassesElement" will never be triggered ... and "classesElementLookup" will keep the anchor reference forever

another thing found in the source (small mistake, no consequence but dead code):

file widget.js / function _on :

if ( selector ) {
	delegateElement.on( eventName, selector, handlerProxy );
} else {
	element.on( eventName, handlerProxy );
}

selector is a string, so the if statement will be ever true should be

if (selector.length)

Change History (4)

comment:1 Changed 20 months ago by steph68

Your demo here https://jqueryui.com/tabs/#manipulation show the problem. Look on events of "#tabs" and "#tabs ul" and play with the add and the close buttons.

$._data($("#tabs")[0], "events");

comment:2 Changed 17 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:3 Changed 17 months ago by Scott González

Milestone: none1.12.2

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

Component: ui.coreui.tabs
Note: See TracTickets for help on using tickets.