lastChild
Summary
Retrieves a reference to the last child of the current node of the filtered TreeWalker hierarchy and updates currentNode.
Method of dom/TreeWalkerdom/TreeWalker
Syntax
var node = treewalker.lastChild();
Return Value
Returns an object of type DOM NodeDOM Node
Object that receives the last child node in the filtered TreeWalker hierarchy.
Examples
var treewalker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
false
);
var node = treewalker.lastChild(); // returns the last visible child of the root element
Notes
Remarks
lastChild sets the currentNode to the returned node.
Syntax
Standards information
Related specifications
- DOM
- Living Standard
Attributions
Mozilla Developer Network : [TreeWalker.lastChild Article]
Microsoft Developer Network: [lastChild Method Article]