jquery.makeCollapsible: fix jQuery memory leak
authorMatmaRex <matma.rex@gmail.com>
Sun, 16 Jun 2013 13:10:28 +0000 (15:10 +0200)
committerMatmaRex <matma.rex@gmail.com>
Sun, 16 Jun 2013 13:10:28 +0000 (15:10 +0200)
commitbf6199135c03ac46926e3f4ba249fe924f8c606a
treed575100ec3b12ff92b6faa6bb4bd1afa72593f57
parent391c28ccbae80bca4de7d1b79d57d4ecfaa02413
jquery.makeCollapsible: fix jQuery memory leak

jQuery saves event data in jQuery.cache and magically clears it when
relevant elements are removed from DOM. However, if an element is
created, has event handlers attached and is never added to the DOM,
it never gets a chance to clear the data, resulting in a memory leak.

Only build the default toggle link when needed to avoid this.

Bug: 49626
Change-Id: I0c92e5c28a66c6a6469e107593dc9b6d3baa8a10
resources/jquery/jquery.makeCollapsible.js