Ticket #2531511 (closed defect)
Reporter Eric Durbin |
Opened: 11/30/11 Last modified: 01/26/12 Status: closed Type: defect Resolution: invalid |
Owner Matt Sweeney |
Target Release: 3.5.0 Priority: P3 (normal) |
|---|---|---|---|
| Summary: | node.remove() memory leak | ||
| Description: | The following code will work fine and clean up properly, however when substituting the outer.innerHTML call in clear_data with Y.one('#inner').remove(); we end up with detached dom subtrees still <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> var counter = 0; function populate(){ var data = document.createElement('div'); document.getElementById('outer').appendChild(data); setTimeout("clear_data()", 5000); { YUI().use('node', function(Y) { start_test(); { populate(); </script> </head> <body class=" yui-skin-sam"> <div id="outer"> |
||
| Type: | defect | Observed in Version: | 3.4.1 |
| Component: | Node | Severity: | S3 (normal) |
| Assigned To: | Matt Sweeney | Target Release: | 3.5.0 |
| Location: | Priority: | P3 (normal) | |
| Tags: | Relates To: | ||
| Browsers: | All | ||
| URL: | |||
| Test Information: | |||
Change History
|
Posted: 12/14/11
|
|
Posted: 12/14/11
|
|
Posted: 01/26/12
|
Sorry I didn't reply earlier, I thought this was regarding another issue.
This is actually the expected behavior of remove(). Removing a dom node from the tree should not break any existing references. Using innerHTML, however can create orphaned dom references and event listeners.
To property clean up Y.Node references, you need to call destroy(). This wont affect the underlying dom. To remove and destroy, call remove(true). You can remove and destroy the node's entire subtree by calling empty().