Skip to content

Commit

Permalink
Tabs: Avoid memory leak during refresh
Browse files Browse the repository at this point in the history
Fixes #10056
Ref gh-1319
  • Loading branch information
scottgonzalez committed Aug 21, 2014
1 parent b397294 commit 2e8e52d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ui/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,10 @@ return $.widget( "ui.tabs", {
},

_processTabs: function() {
var that = this;
var that = this,
prevTabs = this.tabs,
prevAnchors = this.anchors,
prevPanels = this.panels;

this.tablist = this._getList()
.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
Expand Down Expand Up @@ -456,6 +459,13 @@ return $.widget( "ui.tabs", {
this.panels
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
.attr( "role", "tabpanel" );

// Avoid memory leaks (#10056)
if ( prevTabs ) {
this._off( prevTabs.not( this.tabs ) );
this._off( prevAnchors.not( this.anchors ) );
this._off( prevPanels.not( this.panels ) );
}
},

// allow overriding how to find the list for rare usage scenarios (#7715)
Expand Down

0 comments on commit 2e8e52d

Please sign in to comment.