Update to new jsdom API

This commit is contained in:
Pierre Ossman 2017-10-06 10:05:29 +02:00
parent 75393e6a77
commit 0f897520a2
1 changed files with 4 additions and 3 deletions

View File

@ -89,15 +89,16 @@ for (var i = 0;i < opt.argv.length;i++) {
fn = opt.argv[i];
file = fs.readFileSync(fn, "utf8");
doc = jsdom.jsdom(file);
dom = new jsdom.JSDOM(file, { includeNodeLocations: true });
body = dom.window.document.body;
locator = function (elem) {
offset = jsdom.nodeLocation(elem).start;
offset = dom.nodeLocation(elem).startOffset;
line = file.slice(0, offset).split("\n").length;
return fn + ":" + line;
};
process(doc.body, locator, true);
process(body, locator, true);
}
var output = "";