You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Closest traverses the node tree and its parents (heading toward the root node) until it finds a node that matches the full query.
211
-
/*
212
-
Ex:
213
-
query = "div .video-container #div"
214
-
215
-
<div class="video-container id="div"></div>
216
-
217
-
As shown elements with every described specifiers will only match.
218
-
But this is not the case for QuerySearch, QuerySelector and QuerySelectorAll.
219
-
*/
210
+
// Closest traverses the node tree and its parents (heading toward the root node) until it finds a node that matches the selector and returns that node.
220
211
// Adapted from [https://developer.mozilla.org/en-US/docs/Web/API/Element/closest](MDN Element: closest() method)
QuerySearch tokenizes the query string and search for nodes that matches with the right most query token. After matching right most query it proceeds to match nodes parents nodes for left over tokens and then passed that node to (yield/range). QuerySearch search the whole node tree for matches unless yield get canceled or range iterator get cancel.
105
-
*/
106
-
104
+
QuerySearch search returns a iterator that traverse through the node tree from given node and passes nodes that matches the given selector.
0 commit comments