🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

dom-sandbox

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-sandbox

super simple dom sandboxing for testing

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

dom-sandbox

Build Status npm install

super-simple dom sandboxing for tests

Why?

Often times during front-end testing you want to insert some HTML into the DOM or have a dummy element to render things into. This gives you a super-simple way to do that while also preventing you from:

  • stomping on things that something like testling might need in the DOM
  • creating tons of elements and forgetting to tear them down
  • writing this boilerplate, albeit minimal

How?

var dom = require('dom-sandbox')

var testWidget = require('../widget/to/test')

dom('<div id="test-div"><span rel="something-necessary"></span></div>')

testWidget(document.getElementById('test-div'))

or

var dom = require('dom-sandbox')

var testWidget = require('../something/else')

testWidget(dom()) // pass the element directly

Notes

  • Also provides a .destroy() method that removes the generated element from the DOM.

license

MIT

Keywords

browser

FAQs

Package last updated on 15 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts