| Page 1 of 1 | [ 2 posts ] |
|
When using the following code, I get detached dom subtrees with references to objects in the chrome heap tool.
Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Full Page Layout - Example</title> <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script> <script> var counter = 0; function populate() { var data = document.createElement('div'); data.id = 'inner'; for(var i = 0; i < 1000; i++) { counter++; data.innerHTML += '<div id="div_' + counter + '">Blah blah ' + counter + '</div>'; } document.getElementById('outer').appendChild(data); setTimeout("clear_data()", 5000); } function clear_data() { YUI().use('node', function(Y) { //Y.one('#outer').set('innerHTML', ''); Y.one('#inner').remove(); }); start_test(); } function start_test() { populate(); } </script> </head> <body class=" yui-skin-sam"> <div id="top1"> <input type="button" onclick="populate();" value="Add Data" style="z-index: 5000;"> <input type="button" onclick="clear_data();" value="Clear Data" style="z-index: 5000;"> <input type="button" onclick="start_test();" value="Start Test" style="z-index: 5000;"> </div> <div id="outer"> </div> </body> </html> According to the documentation, using node.remove(true) will destroy the node and this does eliminate the detached dom subtrees. Should removing the inner node from the parent "outer" automatically destroy the object when finished with the function, or is this a bug? |
|
The longhand version results in the same behavior.
Code: Y.one('#outer').removeChild(Y.one('#inner')); According to the docs, it passes this through to the dom method and the dom method doesn't exhibit this behavior, so I'm assuming this is a bug. Quote: removeChild ( node ) Node Defined in node/js/node-imports.js:7 Passes through to DOM method. |
| Page 1 of 1 | [ 2 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group