Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.2.13 to 0.2.14

12

lib/jsdom.js

@@ -53,6 +53,2 @@ var dom = exports.dom = require("./jsdom/level3/index").dom,

if (options.features && options.features.QuerySelector) {
require("./jsdom/selectors/index").applyQuerySelectorPrototype(level);
}
var browser = exports.browserAugmentation(level, options),

@@ -63,2 +59,6 @@ doc = (browser.HTMLDocument) ?

if (options.features && options.features.QuerySelector) {
require("./jsdom/selectors/index").applyQuerySelector(doc, level);
}
features.applyDocumentFeatures(doc, options.features);

@@ -201,3 +201,3 @@

callback(errors, window);
process.nextTick(function() { callback(errors, window); });
}

@@ -281,3 +281,3 @@ }

} else {
fs.readFile(url.pathname, processHTML);
fs.readFile(config.html, processHTML);
}

@@ -284,0 +284,0 @@ }

@@ -1,5 +0,1 @@

//Make configurable from docType??
//Set in option
var isXHTML = false;
//List from node-htmlparser

@@ -62,6 +58,3 @@ var singleTags = {

if (singleTags[tagName]) {
if (isXHTML) {
ret.start += "/";
}
ret.start += ">";
ret.start += " />";
ret.end = '';

@@ -68,0 +61,0 @@ } else {

@@ -18,6 +18,7 @@ var http = require('http'),

var vm = require('vm');
var context = vm.createContext(sandbox);
var global = null;
sandbox.run = function(code, filename) {
return vm.runInContext(code, sandbox, filename);
return vm.runInContext(code, context, filename);
};

@@ -27,3 +28,3 @@

if (!global) {
global = vm.runInContext('this', sandbox);
global = vm.runInContext('this', context);
}

@@ -452,8 +453,2 @@ return global;

dom.Element.prototype.__defineSetter__('innerHTML', function(html) {
//Check for lib first
if (html === null) {
return null;
}
//Clear the children first:

@@ -468,3 +463,5 @@ var child;

}
var nodes = htmltodom.appendHtmlToElement(html, this);
if (html !== "" && html != null) {
htmltodom.appendHtmlToElement(html, this);
}
return html;

@@ -479,8 +476,2 @@ });

dom.Document.prototype.__defineSetter__('innerHTML', function(html) {
//Check for lib first
if (html === null) {
return null;
}
//Clear the children first:

@@ -495,3 +486,5 @@ var child;

}
var nodes = htmltodom.appendHtmlToElement(html, this);
if (html !== "" && html != null) {
htmltodom.appendHtmlToElement(html, this);
}
return html;

@@ -498,0 +491,0 @@ });

@@ -166,13 +166,8 @@ var core = require("../level2/core").dom.level2.core,

core.Node.prototype.__defineSetter__('textContent', function(txt) {
if (txt) {
var i = this.childNodes.length-1,
children = this.childNodes,
textNode = this._ownerDocument.createTextNode(txt);
for (i; i>=0; i--) {
this.removeChild(this.childNodes.item(i));
}
this.appendChild(textNode);
for (var i = this.childNodes.length; --i >=0;) {
this.removeChild(this.childNodes.item(i));
}
if (txt !== "" && txt != null) {
this.appendChild(this._ownerDocument.createTextNode(txt));
}
return txt;

@@ -179,0 +174,0 @@ });

var createSizzle = require("./sizzle");
exports.applyQuerySelectorPrototype = function(dom) {
exports.applyQuerySelector = function(doc, dom) {
var addSizzle = function(document) {

@@ -11,22 +11,30 @@

dom.Document.prototype.querySelector = function(selector) {
doc.querySelector = function(selector) {
return addSizzle(this)(selector, this)[0];
};
dom.Document.prototype.querySelectorAll = function(selector) {
doc.querySelectorAll = function(selector) {
return new dom.NodeList(addSizzle(this)(selector, this));
};
dom.Element.prototype.querySelector = function(selector) {
return addSizzle(this.ownerDocument)(selector, this)[0];
var _createElement = doc.createElement;
doc.createElement = function() {
var element = _createElement.apply(this, arguments);
element.querySelector = function(selector) {
return addSizzle(this.ownerDocument)(selector, this)[0];
};
element.querySelectorAll = function(selector) {
var el = this;
if (!this.parentNode) {
el = this.ownerDocument.createElement("div");
el.appendChild(this);
}
return new dom.NodeList(addSizzle(this.ownerDocument)(selector, el.parentNode || el));
};
return element;
};
dom.Element.prototype.querySelectorAll = function(selector) {
var el = this;
if (!this.parentNode) {
el = this.ownerDocument.createElement("div");
el.appendChild(this);
}
return new dom.NodeList(addSizzle(this.ownerDocument)(selector, el.parentNode || el));
};
};
{
"name": "jsdom",
"version": "0.2.13",
"version": "0.2.14",
"description": "A javascript implementation of the W3C DOM",

@@ -130,2 +130,11 @@ "keywords": [

"url" : "https://github.com/deitch"
},
{
"name": "Nao Iizuka",
"email": "iizuka@kyu-mu.net",
"url": "https://github.com/iizukanao"
},
{
"name" : "Peter Perenyi",
"web" : "https://github.com/sinegar"
}

@@ -132,0 +141,0 @@ ],

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