test_treewalker.js (775B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 function run_test() { 7 test_treeWalker_currentNode(); 8 } 9 10 // TEST CODE 11 12 function test_treeWalker_currentNode() { 13 var XHTMLDocString = '<html xmlns="http://www.w3.org/1999/xhtml">'; 14 XHTMLDocString += "<body><input/>input</body></html>"; 15 16 var doc = ParseXML(XHTMLDocString); 17 18 var body = doc.getElementsByTagName("body")[0]; 19 var filter = NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT; 20 var walker = doc.createTreeWalker(body, filter, null); 21 walker.currentNode = body.firstChild; 22 walker.nextNode(); 23 }