Socket
Socket
Sign inDemoInstall

jsdom-global

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdom-global - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

keys.js

3

browser.js

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

module.exports = function (fn) {
if (typeof fn === 'function') return fn()
module.exports = function () {
return noop

@@ -10,0 +9,0 @@ }

@@ -0,1 +1,8 @@

## [v2.1.0]
> Aug 22, 2016
- [#6], [#7] - Fix support for jsdom 9.4.0.
[v2.1.0]: https://github.com/rstacruz/jsdom-global/compare/v2.0.0...v2.1.0
## [v2.0.0]

@@ -74,4 +81,6 @@ > May 13, 2016

[#5]: https://github.com/rstacruz/jsdom-global/issues/5
[#6]: https://github.com/rstacruz/jsdom-global/issues/6
[#7]: https://github.com/rstacruz/jsdom-global/issues/7
[#2]: https://github.com/rstacruz/jsdom-global/issues/2
[@kenjiru]: https://github.com/kenjiru
[@ngryman]: https://github.com/ngryman

@@ -5,11 +5,7 @@ /*

var KEYS = require('./keys')
var defaultHtml = '<!doctype html><html><head><meta charset="utf-8">' +
'</head><body></body></html>'
var blacklist = [
'ArrayBuffer', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray',
'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array',
'Float64Array', 'toString', 'constructor', 'console', 'setTimeout',
'clearTimeout', 'setInterval', 'clearInterval' ]
module.exports = function globalJsdom (html, options) {

@@ -36,7 +32,4 @@ if (html === undefined) {

var window = document.defaultView
var keys = []
Object.keys(window).forEach(function (key) {
if (blacklist.indexOf(key) !== -1) return
keys.push(key)
KEYS.forEach(function (key) {
global[key] = window[key]

@@ -51,3 +44,3 @@ })

function cleanup () {
keys.forEach(function (key) { delete global[key] })
KEYS.forEach(function (key) { delete global[key] })
}

@@ -54,0 +47,0 @@

{
"name": "jsdom-global",
"version": "2.0.0",
"version": "2.1.0",
"description": "Enable DOM in Node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -24,3 +24,3 @@ # jsdom-global

```js
require('jsdom-global')(html, options)
require('jsdom-global')()

@@ -31,3 +31,3 @@ // you can now use the DOM

Both `html` and `options` parameters are optional.
You may also pass parameters to jsdomGlobal() like so: `require('jsdom-global')(html, options)`.
Check the [jsdom.jsdom()][] documentation for valid values for the `options` parameter.

@@ -81,2 +81,13 @@

## ES2015
If you prefer to use `import` rather that `require`, you might want to use `jsdom-global/register` instead. Place it on top of your other import calls.
```js
import 'jsdom-global/register'
import React from 'react'
import jQuery from 'jquery'
// ...
```
## Browserify

@@ -83,0 +94,0 @@

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