So everything was working just fine and great until doing npm update and now things do not work quite as they used to.
A little background: in my code I use jquery
You can try the following with these version settings in your package.json:
"jquery": "^2.1.1",
"jsdom": "^1.0.0-pre.3"
Say you have a file called page.htm:
Document
Html page
left content
Then, you can read from file, create a DOM and window from it with JSDOM and pass it to jquery:
var jsdom = require("jsdom").jsdom;
var fs = require('fs');
fs.readFile('page.htm', {encoding: "utf8"}, function (err, markup) {
if (err) throw err;
var doc = jsdom(markup);
var window = doc.parentWindow;
var $ = require('jquery')(window)
var outerLeft = $(".left").clone().wrap('').parent().html();
var innerLeft = $(".left").html();
console.log(outerLeft, "and ...", innerLeft);
});
will output:
left content
and ...
left content