Elementals.js

Latest Version: 3.0 RC 1 17 July 2017

Method _.Node.eachChild

Iterates through all immediate child nodes inside the passed Element that matches the mask, passing that node to a callback function.

Calling Convention:
_.Node.eachChild(Element, callback[, nodeMask || tagName])
Parameters:
Element
The Element that all child nodes matching the mask inside of will be run past the callbackfunction.
callback
A function handler for all matching nodes inside Element
nodeMask optional

A bitwise mask used to filter the results. See the Node Masking page for more information.

If omitted, a mask of 1 (matching for nodeType 1) is used.

tagName optional
A tagName to match. When used instead of a nodeMask only elements of node type 1 with a matching tagName will be counted.
Returns:
Nothing

Example

HTML

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

JavaScript

var test = document.getElementById('test');
_.Node.eachChild(
	document.getElementByID('test'),
	function(e) {
		console.log(_d.node.text(e));
	}
);

Will output the contents of all those LI.