1.1.0 • Published 9 years ago

dom-document v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

dom-document

tiny module to inject and share DOM document API across modules

ExampleWhyLicense

Example

// in app.js
var dom = require('dom-document')
module.exports = dom.document.createElement('div')
// in test.js
var jsdom = require('jsdom'),
    dom = require('dom-document')
dom.document = jsdom.jsdom()

var el = require('./app.js') //works in node.js too!

Why

This is just a 3 line module to be able to inject global environment variables to be used across an application modules to facilitate testing.

module.export = {
	document: typeof document !== 'undefined' ? document : null
}

Any other global variables can also be added to this same emulated global object

License

Released under the MIT License

1.1.0

9 years ago

1.0.0

9 years ago