Baseline Widely available
Document.createTreeWalker()
ë©ìëë ìë¡ì´ TreeWalker
ê°ì²´ë¥¼ ë°íí©ëë¤.
document.createTreeWalker(root, whatToShow[, filter[, entityReferenceExpansion]]);
매ê°ë³ì
root
ì´ TreeWalker
ìíì ë£¨í¸ Node
ì´ë¤. ì´ê²ì ë³´íµ ì´ ë¬¸ì ìì ì í ì리먼í¸ì´ë¤.
whatToShow
Optional
NodeFilter
ì ìì íë¼í¼í°ë¤ì ì¡°í©íì¬ ë§ë ë¹í¸ë§ì¤í¬ë¥¼ ëíë´ë ì íì ì¸ unsigned long
ì´ë¤. ì´ê²ì í¹ì ì íì ë
¸ë를 íí°ë§íë í¸ë¦¬í ë°©ë²ì´ë¤. 기본ê°ì SHOW_ALL
ìì를 ëíë´ë 0xFFFFFFFF
ì´ë¤.
NodeFilter.SHOW_ALL
-1
(unsigned longì ìµë ê°
) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE
ì§ìì´ ì¤ë¨ëììµëë¤ 2
Shows attribute Attr
nodes. This is meaningful only when creating a TreeWalker
with an Attr
node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree. NodeFilter.SHOW_CDATA_SECTION
ì§ìì´ ì¤ë¨ëììµëë¤ 8
Shows CDATASection
nodes. NodeFilter.SHOW_COMMENT
128
Shows Comment
nodes. NodeFilter.SHOW_DOCUMENT
256
Shows Document
nodes. NodeFilter.SHOW_DOCUMENT_FRAGMENT
1024
Shows DocumentFragment
nodes. NodeFilter.SHOW_DOCUMENT_TYPE
512
Shows DocumentType
nodes. NodeFilter.SHOW_ELEMENT
1
Shows Element
nodes. NodeFilter.SHOW_ENTITY
ì§ìì´ ì¤ë¨ëììµëë¤ 32
Shows Entity
nodes. This is meaningful only when creating a TreeWalker
with an Entity
node as its root; in this case, it means that the Entity
node will appear in the first position of the traversal. Since entities are not part of the document tree, they do not appear when traversing over the document tree. NodeFilter.SHOW_ENTITY_REFERENCE
ì§ìì´ ì¤ë¨ëììµëë¤ 16
Shows EntityReference
nodes. NodeFilter.SHOW_NOTATION
ì§ìì´ ì¤ë¨ëììµëë¤ 2048
Shows Notation
nodes. This is meaningful only when creating a TreeWalker
with a Notation
node as its root; in this case, it means that the Notation
node will appear in the first position of the traversal. Since entities are not part of the document tree, they do not appear when traversing over the document tree. NodeFilter.SHOW_PROCESSING_INSTRUCTION
64
Shows ProcessingInstruction
nodes. NodeFilter.SHOW_TEXT
4
Shows Text
nodes.
filter
Optional
ì íì ì¸ NodeFilter
ì´ë¤. TreeWalker
ê° whatToShow
ì²´í¬ë¥¼ íµê³¼í ë
¸ëì ì¹ì¸ì¬ë¶ë¥¼ íë¨í기 ìí´ í¸ì¶íë acceptNode
ë©ìë를 ê°ì§ ê°ì²´ì´ë¤.
entityReferenceExpansion
Optional ì§ìì´ ì¤ë¨ëììµëë¤
í EntityReference
를 ë²ë¦´ ë ê·¸ ì ì²´ íì í¸ë¦¬ë¥¼ ê°ì´ ë²ë ¤ì¼íëì§ë¥¼ ëíë´ë Boolean
íëê·¸ì´ë¤.
ìë¡ì´ TreeWalker
ê°ì²´.
ë¤ì ìì ë bodyì 모ë ë
¸ëë¤ì ìííê³ , ë
¸ëì ì§í©ì ì리먼í¸ë¡ ì¤ì´ê³ , ë¨ìí ê° ë
¸ë를 ì¹ì¸íê³ (ëì acceptNode()
ë©ìëìì ê·¸ ì§í©ì ì¤ì¼ ìë ìë¤), ë
¸ëë¤(ì§ê¸ì 모ë ì리먼í¸ì§ë§)ì ì ì§í기 ìí´ ìì±ë í¸ë¦¬ ì커 ë°ë³µì를 ì´ì©íì¬ ë°°ì´ì í¸ìíë¤.
var treeWalker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_ELEMENT,
{
acceptNode: function (node) {
return NodeFilter.FILTER_ACCEPT;
},
},
false,
);
var nodeList = [];
while (treeWalker.nextNode()) nodeList.push(treeWalker.currentNode);
ëª
ì¸ ë¸ë¼ì°ì í¸íì± ì°¸ê³
TreeWalker
.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4