diff options
author | Scott González <scott.gonzalez@gmail.com> | 2014-08-20 16:04:54 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2014-08-21 09:06:56 -0400 |
commit | 849c6fd5376e12c6093c557bd4836ef0b145f145 (patch) | |
tree | 199e28fe19ce1a863b86c8245d70187448ffd0c4 | |
parent | 2e8e52dec1eaa06ed170a0ed9769c7b97129c955 (diff) | |
download | jquery-ui-849c6fd5376e12c6093c557bd4836ef0b145f145.tar.gz jquery-ui-849c6fd5376e12c6093c557bd4836ef0b145f145.zip |
Accordion: Avoid memory leak during refresh
Ref #10056
Closes gh-1319
-rw-r--r-- | ui/accordion.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/accordion.js b/ui/accordion.js index 5b748a3f2..946437197 100644 --- a/ui/accordion.js +++ b/ui/accordion.js @@ -259,13 +259,22 @@ return $.widget( "ui.accordion", { }, _processPanels: function() { + var prevHeaders = this.headers, + prevPanels = this.panels; + this.headers = this.element.find( this.options.header ) .addClass( "ui-accordion-header ui-state-default ui-corner-all" ); - this.headers.next() + this.panels = this.headers.next() .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) .filter( ":not(.ui-accordion-content-active)" ) .hide(); + + // Avoid memory leaks (#10056) + if ( prevPanels ) { + this._off( prevHeaders.not( this.headers ) ); + this._off( prevPanels.not( this.panels ) ); + } }, _refresh: function() { |