JSPM

  • Created
  • Published
  • Downloads 1024
  • Score
    100M100P100Q106961F

A browser-lite environment for nodejs

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

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