diff options
author | Scott González <scott.gonzalez@gmail.com> | 2014-08-20 15:57:12 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2014-08-21 09:06:49 -0400 |
commit | 2e8e52dec1eaa06ed170a0ed9769c7b97129c955 (patch) | |
tree | 821d4bb5705f50f40a2945b6adc2e09e16367741 /ui/tabs.js | |
parent | b397294d42e783aacd4cc3a52bbe3aacc0f3f725 (diff) | |
download | jquery-ui-2e8e52dec1eaa06ed170a0ed9769c7b97129c955.tar.gz jquery-ui-2e8e52dec1eaa06ed170a0ed9769c7b97129c955.zip |
Tabs: Avoid memory leak during refresh
Fixes #10056
Ref gh-1319
Diffstat (limited to 'ui/tabs.js')
-rw-r--r-- | ui/tabs.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ui/tabs.js b/ui/tabs.js index c45d6b3f6..e45a97c72 100644 --- a/ui/tabs.js +++ b/ui/tabs.js @@ -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" ) @@ -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) |