{"ScriptPreparationCode":"// language=HTML\r\nconst html = \u0060\r\n \u003C!-- article out start --\u003E\r\n \u003Carticle\u003E\r\n \u003C!-- article in start --\u003E\r\n \u003Ch1\u003ELorem ipsum\u003C/h1\u003E\r\n \u003Cp\u003ELorem ipsum dolor sit amet, consectetur adipisicing elit. Cumque, nostrum.\u003C/p\u003E\r\n \u003C!-- article in end --\u003E\r\n \u003C/article\u003E\r\n \u003C!-- article out end --\u003E\r\n\r\n \u003C!-- article out start --\u003E\r\n \u003Carticle\u003E\r\n \u003C!-- article in start --\u003E\r\n \u003Ch1\u003ELorem ipsum\u003C/h1\u003E\r\n \u003Cp\u003ELorem ipsum dolor sit amet, consectetur adipisicing elit. Cumque, nostrum.\u003C/p\u003E\r\n \u003C!-- article in end --\u003E\r\n \u003C/article\u003E\r\n \u003C!-- article out end --\u003E\r\n\r\n \u003C!-- article out start --\u003E\r\n \u003Carticle\u003E\r\n \u003C!-- article in start --\u003E\r\n \u003Ch1\u003ELorem ipsum\u003C/h1\u003E\r\n \u003Cp\u003ELorem ipsum dolor sit amet, consectetur adipisicing elit. Cumque, nostrum.\u003C/p\u003E\r\n \u003C!-- article in end --\u003E\r\n \u003C/article\u003E\r\n \u003C!-- article out end --\u003E\r\n\u0060;\r\nconst template = document.createElement(\u0027template\u0027);\r\ntemplate.innerHTML = html;\r\n\r\nwindow.testTemplate = template;\r\n\r\nwindow.testTraverse = function traverse(node, use) {\r\n if (!node) return;\r\n\r\n use(node);\r\n traverse(node.firstChild, use);\r\n traverse(node.nextSibling, use);\r\n}","TestCases":[{"Name":"Traverse function","Code":"const textNodes = [];\r\ntestTraverse(testTemplate.content.firstChild, node =\u003E {\r\n if (node.nodeType === Node.SHOW_TEXT) {\r\n textNodes.push(node);\r\n }\r\n});","IsDeferred":false},{"Name":"NodeIterator","Code":"const nodeIterator = document.createNodeIterator(\r\n testTemplate.content,\r\n NodeFilter.SHOW_TEXT\r\n);\r\n\r\nconst textNodes = [];\r\nwhile (nodeIterator.nextNode()) {\r\n textNodes.push(nodeIterator.currentNode);\r\n}","IsDeferred":false},{"Name":"TreeWalker","Code":"const treeWalker = document.createTreeWalker(\r\n testTemplate.content,\r\n NodeFilter.SHOW_TEXT\r\n);\r\n\r\nconst textNodes = [];\r\nwhile (treeWalker.nextNode()) {\r\n textNodes.push(treeWalker.currentNode);\r\n}","IsDeferred":false}]}