Elementals.js

Latest Version: 2.0 RC 3 14 March 2017

Method _.nodeFlush

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:
_.nodeFlush(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

_.nodeFlush(document.getElementById('test'));

ul#test will now have no content inside it.