Skip to content

Instantly share code, notes, and snippets.

@bingeboy
Created July 18, 2013 03:36
Show Gist options
  • Save bingeboy/6026536 to your computer and use it in GitHub Desktop.
Save bingeboy/6026536 to your computer and use it in GitHub Desktop.
jsdom loading jquery and loading a file.
var http = require('http')
, fs = require('fs')
, util= require('util');
var jsdom = require("jsdom")
, $ = require("jquery");
jsdom.env(
"./index.html",
["http://code.jquery.com/jquery.js"],
function (errors, window) {
console.log("there have been", window.$("a").length, "nodejs releases!~~~~~~~~~~~~~~~:");
}
);
var server = http.createServer( function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain'
}
);
res.end("blap bam boom! a test");
}).listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment