NodeIterator or TreeWalker Objects in JSDOM

I am trying to use jsdom in node.js to do a little conversion to an HTML document. In my client tests, I used the document.createTreeWalker and document.createNodeIterator functions that are part of the DOM 2 specification ... however, they apparently are not part of jsdom, although its authors claim that it is fully compatible with DOM1 and DOM2. Am I missing something? Are these functions available in a jsdom generated document?

 $ node > var jsdom = require('jsdom'); > var doc = jsdom.jsdom('<div>Test</div><div>One</div><div>Two</div>'); > doc.createTreeWalker(doc) TypeError: Object [ null ] has no method 'createTreeWalker' at [object Context]:1:5 at Interface.<anonymous> (repl.js:171:22) at Interface.emit (events.js:64:17) at Interface._onLine (readline.js:153:10) at Interface._line (readline.js:408:8) at Interface._ttyWrite (readline.js:585:14) at ReadStream.<anonymous> (readline.js:73:12) at ReadStream.emit (events.js:81:20) at ReadStream._emitKey (tty_posix.js:307:10) at ReadStream.onData (tty_posix.js:70:12) 
+6
source share

Source: https://habr.com/ru/post/896736/


All Articles