Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 795 Bytes

File metadata and controls

43 lines (31 loc) · 795 Bytes
title short-title slug page-type browser-compat
TreeWalker: currentNode property
currentNode
Web/API/TreeWalker/currentNode
web-api-instance-property
api.TreeWalker.currentNode

{{ APIRef("DOM") }}

The TreeWalker.currentNode property represents the {{domxref("Node")}} which the {{domxref("TreeWalker")}} is currently pointing at.

Value

A {{domxref("Node")}}.

Examples

const treeWalker = document.createTreeWalker(
  document.body,
  NodeFilter.SHOW_ELEMENT,
  {
    acceptNode(node) {
      return NodeFilter.FILTER_ACCEPT;
    },
  },
);
root = treeWalker.currentNode; // the root element as it is the first element!

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • The {{domxref("TreeWalker")}} interface.