This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

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