Package Exports
- can-vdom
- can-vdom/make-document/make-document
- can-vdom/make-window/make-window
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (can-vdom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
can-vdom
A browser-lite environment for nodejs
API
{Object}
A browser-lite environment for Node.js.
require("can-vdom");
window === global; // true
document.getElementsByTagName("body"); // [HTMLBodyElement]Object
can-vdom/make-window/make-window function
Exports a function that window called, returns an object that looks like a window.
makeWindow()
Creates a document and places it, along with other common browser globals, on a new object and then returns that object.
- returns
{window}: An object with common browser globals.
makeWindow(global)
Creates a document and places it, along with other common browser globals, on the global object.
var makeWindow = require("can-vdom/make-window/make-window");
var window = makeWindow({});- global
{window}: An object that represents the environment's global.
can-vdom/make-document/make-document function
Exports a function that when called, returns a dom-light document object.
makeDocument()
Creates a new simple document using [can-simple-dom]. Provides light-weight document needs, mostly for server-side rendering.
- returns
{can-simple-dom/document/document}: A can-simple-dom document.
window {Object}
An object representing a fake window object.
Object
document
{can-simple-dom/document/document}: A browser documentwindow
{Object}: The window itself.self
{Object}: Theselfobject is an alias forwindow.addEventListener
{function}: A stub forwindow.addEventListener, does not actually set up events unless overridden some place else.removeEventListener
{function}: A stub forwindow.removeEventListener.navigator
{Object}:location
{Object}:history
{Object}:
Contributing
Making a Build
To make a build of the distributables into dist/ in the cloned repository run
npm install
node buildRunning the tests
Tests can run in the browser by opening a webserver and visiting the test.html page.
Automated tests that run the tests from the command line in Firefox can be run with
npm test