node package manager

can-vdom

can-vdom

Build Status

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({});
  1. 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 document

  • window {Object}: The window itself.

  • self {Object}: The self object is an alias for window.

  • addEventListener {function}: A stub for window.addEventListener, does not actually set up events unless overridden some place else.

  • removeEventListener {function}: A stub for window.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 build

Running 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