Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (26 sloc) 1.249 kB

jsdom

CommonJS implementation of the DOM intended to be platform independent and as minimal/light as possible while completely adhering to the w3c DOM specifications.

Currently Implemented and w3c Compliant:

  • DOM Level 1 (html/svg/xml)
  • Browser (BOM) Augmentation (getElementsByClassName, getElementById, etc..)

Note: Running the tests now requires mjsunit.runner

see: testlog for w3 test compliance

see: plan for roadmap and thoughts about this project

see: project site for additional information

Examples

jQuery

  var sys    = require("sys"),
      jsdom  = require(__dirname + "/../../lib/jsdom"),
      window = jsdom.jsdom().createWindow();
  
  // this also works:
  // jQueryTag.src = "http://code.jquery.com/jquery-1.4.2.js";
  jsdom.jQueryify(window, __dirname + "/jquery.js", function() {
    window.jQuery('body').append("<div class='testing'>Hello World, It works!</div>");
    sys.puts(window.jQuery(".testing").text());
  });
Jump to Line
Something went wrong with that request. Please try again.