New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jsdomify

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdomify - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

25

lib/classList.js

@@ -26,4 +26,6 @@ /*

*/
module.exports = function(window) {
"use strict";
module.exports = function (window) {
if (typeof window.Element === "undefined" || "classList" in window.document.documentElement) return;

@@ -40,3 +42,3 @@

// to retrieve a list of classes.
var classes = el.className.replace(/^\s+|\s+$/g, '').split(/\s+/);
var classes = el.className.replace(/^\s+|\s+$/g, "").split(/\s+/);
for (var i = 0; i < classes.length; i++) {

@@ -48,3 +50,3 @@ push.call(this, classes[i]);

DOMTokenList.prototype = {
add: function(token) {
add: function add(token) {
if (this.contains(token)) return;

@@ -54,9 +56,9 @@ push.call(this, token);

},
contains: function(token) {
contains: function contains(token) {
return this.el.className.indexOf(token) != -1;
},
item: function(index) {
item: function item(index) {
return this[index] || null;
},
remove: function(token) {
remove: function remove(token) {
if (!this.contains(token)) return;

@@ -69,6 +71,6 @@ for (var i = 0; i < this.length; i++) {

},
toString: function() {
return join.call(this, ' ');
toString: function toString() {
return join.call(this, " ");
},
toggle: function(token) {
toggle: function toggle(token) {
if (!this.contains(token)) {

@@ -96,6 +98,5 @@ this.add(token);

defineElementGetter(window.Element.prototype, 'classList', function() {
defineElementGetter(window.Element.prototype, "classList", function () {
return new DOMTokenList(this);
});
};
};

@@ -1,9 +0,11 @@

var jsdom = require('jsdom').jsdom;
'use strict';
var actualDOM;
var _jsdom = require('jsdom');
exports.create = function(domString) {
var actualDOM = undefined;
var create = function create(domString) {
actualDOM = domString || '';
global.document = jsdom(domString || '');
global.document = (0, _jsdom.jsdom)(actualDOM);
global.window = document.defaultView;

@@ -19,11 +21,10 @@ global.Element = window.Element;

exports.clear = function() {
this.destroy();
this.create(actualDOM);
var clear = function clear() {
destroy();
create(actualDOM);
};
exports.destroy = function(clearRequireCache) {
var destroy = function destroy(clearRequireCache) {
var undefined;
if(clearRequireCache === undefined) {
if (typeof clearRequireCache === 'undefined') {
clearRequireCache = true;

@@ -33,3 +34,3 @@ }

window.close();
delete document;
delete global.document;

@@ -43,3 +44,8 @@ if (clearRequireCache) {

}
};
};
module.exports = {
create: create,
clear: clear,
destroy: destroy
};
{
"name": "jsdomify",
"version": "0.3.2",
"version": "0.4.0",
"description": "Create a JSDom instance for browserless testing, exposing some handling methods",

@@ -13,7 +13,10 @@ "main": "lib/jsdomify.js",

"devDependencies": {
"babel": "5.6.23",
"mocha": "2.2.5",
"unexpected": "7.4.0"
"unexpected": "9.2.1"
},
"scripts": {
"test": "mocha"
"test": "mocha --compilers js:babel/register",
"compile": "babel -d lib/ src/",
"prepublish": "npm run compile"
},

@@ -20,0 +23,0 @@ "files": [

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