This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

TreeWalker.currentNode

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015년 7월⁩.

TreeWalker.currentNode 속성은 TreeWalker가 현재 가리키고 있는 Node를 나타낸다.

구문

js
node = treeWalker.currentNode;
treeWalker.currentNode = node;

예제

js
var treeWalker = document.createTreeWalker(
  document.body,
  NodeFilter.SHOW_ELEMENT,
  {
    acceptNode: function (node) {
      return NodeFilter.FILTER_ACCEPT;
    },
  },
  false,
);
root = treeWalker.currentNode; // 첫번째 엘리먼트인 루트 엘리먼트!

명세

Specification
DOM
# dom-treewalker-currentnode

브라우저 호환성

같이 보기