Click to See Complete Forum and Search --> : Does 'removeChild' actually reduce document size?


keikee
08-19-2004, 12:59 AM
When you use the DOM 'removeChild' function to delete an element from a document, you are not actually reducing the document size within the browser, right? Aren't you basically just turning off the visibility for the deleted object?

I ask because I was curious if pruning elements from a page that is growing dynamically would result in any reduction of load on the browser.

fredmv
08-19-2004, 07:26 AM
Welcome to the forums.

I interpreted your question in two ways. If by "reducing the document size in the browser" you were referring to that it actually reduces the filesize of the document, this is not true. The element is completely deleted from the node tree (DOM), however the file is completely untouched.

If however, you meant by "reducing the document size in the browser" you meant that, upon removing the element, it would interrupt document flow, yes it indeed will. Since the element is completely deleted, it doesn't even exist anymore, therefore the document is displayed as if it wasn't even there to begin with.

keikee
08-19-2004, 09:00 AM
fredmv,

Thanks for the welcome, and for your quick reply to my question!