Elementals.js

Latest Version: 3.0 RC 1 17 July 2017

Method _.Node.flush

Deletes all child nodes inside the passed Element. This is functionally similar to "Element.innerHTML = '';" except that it does so on the DOM, bypassing the parser. Depending on the size of your document, this is typically faster and uses less CPU time/power and less RAM as instead of creating a new DOM by parsing the entire document, we're simply directly deleting nodes from the DOM.

Calling Convention:
_.Node.flush(Element)
Parameters:
Element
The Element to remove the contents of.
Returns:
YOU GET NOTHING!!!

Example

HTML

<ul id="test">
	<li>First</li>
	<li>Second</li>
	<li>Third</li>
</ul>

JavaScript

_.Node.flush(document.getElementById('test'));

ul#test will now have no content inside it.