Socket
Socket
Sign inDemoInstall

jsdom

Package Overview
Dependencies
103
Maintainers
6
Versions
258
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 21.1.2 to 22.0.0

2

lib/jsdom/browser/Window.js

@@ -7,3 +7,3 @@ "use strict";

const { installInterfaces } = require("../living/interfaces");
const { define, mixin, performance } = require("../utils");
const { define, mixin } = require("../utils");
const Element = require("../living/generated/Element");

@@ -10,0 +10,0 @@ const EventTarget = require("../living/generated/EventTarget");

"use strict";
const EventTargetImpl = require("../events/EventTarget-impl").implementation;
const { performance } = require("../../utils");

@@ -6,0 +5,0 @@ class PerformanceImpl extends EventTargetImpl {

@@ -576,3 +576,3 @@ "use strict";

if (this.type === "file") {
this[filesSymbol] = this[filesSymbol] || FileList.createImpl(this._globalObject);
this[filesSymbol] ||= FileList.createImpl(this._globalObject);
} else {

@@ -579,0 +579,0 @@ this[filesSymbol] = null;

@@ -5,3 +5,2 @@ "use strict";

const { domSymbolTree } = require("./living/helpers/internal-constants");
const perfHooks = require("perf_hooks");
const SYMBOL_TREE_POSITION = require("symbol-tree").TreePosition;

@@ -149,21 +148,7 @@

// TODO: remove once Node v16 is the minimum version.
exports.performance = globalThis.performance || perfHooks.performance;
/* eslint-disable global-require */
exports.Canvas = null;
let canvasInstalled = false;
try {
require.resolve("canvas");
canvasInstalled = true;
} catch (e) {
// canvas is not installed
exports.Canvas = require("canvas");
} catch {
exports.Canvas = null;
}
if (canvasInstalled) {
const Canvas = require("canvas");
if (typeof Canvas.createCanvas === "function") {
// In browserify, the require will succeed but return an empty object
exports.Canvas = Canvas;
}
}
{
"name": "jsdom",
"version": "21.1.2",
"version": "22.0.0",
"description": "A JavaScript implementation of many web standards",

@@ -24,4 +24,2 @@ "keywords": [

"abab": "^2.0.6",
"acorn": "^8.8.2",
"acorn-globals": "^7.0.0",
"cssstyle": "^3.0.0",

@@ -31,3 +29,2 @@ "data-urls": "^4.0.0",

"domexception": "^4.0.0",
"escodegen": "^2.0.0",
"form-data": "^4.0.0",

@@ -63,28 +60,15 @@ "html-encoding-sniffer": "^3.0.0",

"benchmark": "^2.1.4",
"browserify": "^17.0.0",
"chai": "^4.3.7",
"eslint": "^8.36.0",
"eslint": "^8.39.0",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-jsdom-internal": "link:./scripts/eslint-plugin",
"js-yaml": "^4.1.0",
"karma": "^6.4.1",
"karma-browserify": "^8.1.0",
"karma-chrome-launcher": "^3.1.1",
"karma-mocha": "^2.0.1",
"karma-mocha-webworker": "^1.3.0",
"minimatch": "^7.4.2",
"minimatch": "^9.0.0",
"mocha": "^10.2.0",
"mocha-sugar-free": "^1.4.0",
"pngjs": "^7.0.0",
"rimraf": "^4.4.0",
"server-destroy": "^1.0.1",
"watchify": "^4.0.0",
"webidl2js": "^17.1.0",
"yargs": "^17.7.1"
"yargs": "^17.7.2"
},
"browser": {
"canvas": false,
"vm": "./lib/jsdom/vm-shim.js",
"./lib/jsdom/living/websockets/WebSocket-impl.js": "./lib/jsdom/living/websockets/WebSocket-impl-browser.js"
},
"scripts": {

@@ -98,12 +82,8 @@ "prepare": "yarn convert-idl && yarn generate-js-globals",

"test": "mocha test/index.js",
"test-browser-iframe": "karma start test/karma.conf.js",
"test-browser-worker": "karma start test/karma-webworker.conf.js",
"test-browser": "yarn test-browser-iframe && yarn test-browser-worker",
"lint": "eslint . --cache --ext .js,.html",
"init-wpt": "git submodule update --init --recursive",
"reset-wpt": "rimraf ./test/web-platform-tests/tests && yarn init-wpt",
"reset-wpt": "rm -rf ./test/web-platform-tests/tests && yarn init-wpt",
"update-wpt": "git submodule update --recursive --remote && cd test/web-platform-tests/tests && python3 wpt.py manifest --path ../wpt-manifest.json",
"update-authors": "git log --format=\"%aN <%aE>\" | sort -f | uniq > AUTHORS.txt",
"benchmark": "node ./benchmark/runner",
"benchmark-browser": "node ./benchmark/runner --bundle",
"convert-idl": "node ./scripts/webidl/convert.js",

@@ -114,4 +94,4 @@ "generate-js-globals": "node ./scripts/generate-js-globals.js"

"engines": {
"node": ">=14"
"node": ">=16"
}
}

@@ -8,3 +8,3 @@ <h1 align="center">

The latest versions of jsdom require Node.js v14 or newer. (Versions of jsdom below v20 still work with previous Node.js versions, but are unsupported.)
The latest versions of jsdom require Node.js v16 or newer. (Versions of jsdom below v22 still work with previous Node.js versions, but are unsupported.)

@@ -450,12 +450,2 @@ ## Basic usage

### Running jsdom inside a web browser
jsdom has some support for being run inside a web browser, using [browserify](https://browserify.org/). That is, inside a web browser, you can use a browserified jsdom to create an entirely self-contained set of plain JavaScript objects which look and act much like the browser's existing DOM objects, while being entirely independent of them. "Virtual DOM", indeed!
jsdom's primary target is still Node.js, and so we use language features that are only present in recent Node.js versions. Thus, older browsers will likely not work. (Even transpilation will not help: we use `Proxy`s extensively throughout the jsdom codebase.)
Notably, jsdom works well inside a web worker. The original contributor, [@lawnsea](https://github.com/lawnsea/), who made this possible, has [published a paper](https://pdfs.semanticscholar.org/47f0/6bb6607a975500a30e9e52d7c9fbc0034e27.pdf) about his project which uses this capability.
Not everything works perfectly when running jsdom inside a web browser. Sometimes that is because of fundamental limitations (such as not having filesystem access), but sometimes it is simply because we haven't spent enough time making the appropriate small tweaks. Bug reports are certainly welcome.
### Debugging the DOM using Chrome DevTools

@@ -462,0 +452,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc