Hello,
I'm not having much success getting scripts to execute using
jsdom.jsdom(). I seem to have followed all of the docs, and gone
through a lot of the code. I see how setting
defaultDocumentFeatures = {
FetchExternalResources: ['script'],
ProcessExternalResources: ['script'],
etc etc
}
and calling jsdom.jsdom(data).createWindow() sets a property
_implementation._features on document, but the value on each property
in the _features object is just ['script']. None of my scripts are
actually being executed, and the HTML that I'm retrieving from a test
page via
node.io is without DOM-injected elements onload.
How can I get the scripts to execute?
/*
node.io's getHtml fcn, working correctly */
this.getHtml('
http://www.ispyfoolprooffour.com', function(err, $,
data) {
// can we call/load scripts here??
window = jsdom.jsdom(data, null, {
feautres: {
FetchExternalResources: ['script'],
ProcessExternalResources: ['script']
}
}).createWindow();
res.writeHead(200, {
'Content-Type': 'text/plain'
});
res.write(window.document.body.innerHTML);
res.end();
self.emit(); // irrelevant at the moment
});
the innerHTML should contain <li> elements inside the ul#post element.
I've also tried just calling jsdom.jsdom(data).createWindow(), using
node.io's options parameter to pass the documentFeatures
configuration. Neither works, and I'm inclined to use Phantomjs
instead, which does return the right HTML.
Please advise! Thanks so much!
Noah