This doesn't work the way it sounds does it?

39 views
Skip to first unread message

Joe Medley

unread,
Mar 29, 2016, 11:35:10 PM3/29/16
to jsdom
The description of jsdom.env() has this for the second parameter:
  • scripts: a string or array of strings, containing file names or URLs that will be inserted as <script> tags
This implies that I can do something like:

jsdom.env(myFullHTMLDocument, 'path/to/script.js', cb()); 

and script.js will be automagically inserted into my document. 

I'm either missing something or I need some clarification. Can someone help?

Thank you.

bay chae

unread,
Apr 15, 2016, 5:00:09 AM4/15/16
to jsdom
Try the example:

var jsdom = require("jsdom");

jsdom
.env(
'<p><a class="the-link" href="https://github.com/tmpvar/jsdom">jsdom!</a></p>',
["http://code.jquery.com/jquery.js"],
function (err, window) {
console.log("contents of a.the-link:", window.$("a.the-link").text());
}
);

Reply all
Reply to author
Forward
0 new messages