jQuery with a thin wrapper for Ender.JS, Node.JS, and other npm-based packaging systems
JavaScript
Latest commit 088ce4a Mar 3, 2015 @coolaj86 coolaj86 Merge pull request #73 from embeepea/master
update README.md with note about jsdom version restrictions

README.md

OLD

Deprecated

Don't use the actual code in this repo. It's obsolete and only kept around for legacy apps. jquery added support for node in 2.1.x. Use that instead.

NEW: How to use jQuery >= 2.1.x in Node.js

How to use jQuery >= 2.x in Node.js >= 0.10

npm install -S 'jquery@>=2.1'
npm install -S 'jsdom@3.1.2'

(Note that version 3.1.2 of jsdom is required, because as of jsdom version 4.0.0, jsdom no longer works with Node.js. If you use Io.js rather than Node.js, you can use the latest 4.x release of jsdom.)

testjq.js:

(function () {
  'use strict';

  var env = require('jsdom').env
    , html = '<html><body><h1>Hello World!</h1><p class="hello">Heya Big World!</body></html>'
    ;

  // first argument can be html string, filename, or url
  env(html, function (errors, window) {
    console.log(errors);

    var $ = require('jquery')(window)
      ;

    console.log($('.hello').text());
  });
}());

The instructions above are for the new official jquery which, for some reason, doesn't have instructions for node in their README.