Comparing version 0.1.11 to 0.1.12
@@ -7,3 +7,3 @@ | ||
createWindow = require("./jsdom/browser").createWindow; | ||
var createWindow = exports.createWindow = require("./jsdom/browser").createWindow; | ||
@@ -26,13 +26,2 @@ exports.jsdom = function (level) { | ||
exports.createWindow = function (html, level) { | ||
if (html) { | ||
var window = createWindow(); | ||
window.document = new (level || exports.defaultLevel)(); | ||
window.document.innerHTML = html; | ||
return window; | ||
} else { | ||
return createWindow(); | ||
} | ||
}; | ||
exports.jQueryify = function (window /* path [optional], callback */) { | ||
@@ -39,0 +28,0 @@ |
{ | ||
"name": "jsdom", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "CommonJS implementation of the DOM intended to be platform independent and as minimal/light as possible while completely adhering to the w3c DOM specifications.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -43,4 +43,4 @@ # jsdom | ||
var jsdom = require("jsdom"), | ||
window = jsdom.createWindow( | ||
var jsdom = require("jsdom").jsdom, | ||
window = jsdom().createWindow( | ||
"<html><head></head><body>hello world</body></html>" | ||
@@ -58,11 +58,24 @@ ); | ||
## jQuery | ||
## Load arbitrary scripts | ||
var jsdom = require("jsdom").jsdom, | ||
window = jsdom().createWindow(), | ||
script = window.document.createElement("script"); | ||
var sys = require("sys"), | ||
jsdom = require(__dirname + "/../../lib/jsdom"), | ||
script.src = 'http://code.jquery.com/jquery-1.4.2.js'; | ||
script.onload = function() { | ||
if (this.readyState === 'complete') { | ||
console.log(window.jQuery.fn.jquery); | ||
// outputs: 1.4.2 | ||
} | ||
}; | ||
## jQueryify | ||
var jsdom = require("jsdom"), | ||
window = jsdom.jsdom().createWindow(); | ||
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()); | ||
jsdom.jQueryify(window, "http://code.jquery.com/jquery-1.4.2.min.js" , function() { | ||
window.jQuery('body').append(<div class='testing'>Hello World, It works</div>"); | ||
console.log(window.jQuery(".testing").text()); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78018799
80
130518