I'm newish to nodejs and am having difficulty trying to come up with a solution to fully flush out the following:
Here is a link to my code: https://gist.github.com/bingeboy/6087474
I was missing the jsdom.jsdom method.
var jsdom = require("jsdom");
Needed to be:
var jsdom = require("jsdom").jsdom;
This allowed the window callback to load the file. Previously I was getting the file in the error cb. var fs = require('fs') , jsdom = require('jsdom').jsdom;
var htmlSource = fs.readFileSync(__dirname + "/date.html", "utf8")
, document = jsdom(htmlSource)
, window = document.parentWindow;
console.log(typeof window.document.getElementsByClassName); //function
console.log(window.document.getElementsByTagName('a')[1].innerHTML); //logs link text "311.json"