Socket
Socket
Sign inDemoInstall

jsdom

Package Overview
Dependencies
Maintainers
1
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdom - npm Package Compare versions

Comparing version 0.1.11 to 0.1.12

13

lib/jsdom.js

@@ -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 @@

2

package.json
{
"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("&lt;div class='testing'&gt;Hello World, It works!&lt;/div&gt;");
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc