Skip to content

Instantly share code, notes, and snippets.

@arian
Created March 30, 2012 13:01
Show Gist options
  • Save arian/2251356 to your computer and use it in GitHub Desktop.
Save arian/2251356 to your computer and use it in GitHub Desktop.
var jsdom = require('jsdom')
var fs = require('fs')
var nodes = fs.readFileSync("../nodes.js").toString();
jsdom.env({
features: {
QuerySelector: true
},
src: [nodes],
html: "<!DOCTYPE html><html><head></head><body><div id='test'>text</div></body></html>",
done: function(err, window){
var $ = window.nodes
console.log($('#test').id())
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment