Skip to content
/ dom.js Public
forked from andreasgal/dom.js

Self-hosted JavaScript implementation of a WebIDL-compliant HTML5 DOM.

License

Notifications You must be signed in to change notification settings

nanqiu/dom.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The goal of this project is to evaluate whether it is feasible to implement a
WebIDL-compliant HTML5 DOM in JavaScript. While a couple other self-hosted
JavaScript DOM implementations exist, none of them are WebIDL-compliant
(i.e. properties don't live on the prototype but directly on each node, for
example). Also, all other implementations do not provide proper encapsulation.
The details of the implementation leak through the API.

The code uses ES5, Proxies and WeakMaps as well as Spidermonkey features
such as const, let and destructuring assignment.  It should run in
Firefox 6.

The Makefile generates dom.js from many smaller files in the src/
directory. dom.js includes all of the smaller files within one large
closure so the variables and constants that appear to be global do
not, in fact, leak into the global scope.

The src/impl/ directory contains an implementation of the DOM using
plain JavaScript objects.  By itself, this is not a conforming
implementation because its internal properties are visible.

The src/idl/ directory implements WebIDL-compliant DOM
interfaces on top of the implementation objects.  Each interface
object has a corresponding implementation object, and a WeakMap
maintains the mapping from interfaces to implementations so that the
interface object does not require a property that refers to the
implementation.

Installing
======

Get a copy of the dom.js source.

Install node.js
    http://nodejs.org/#download

Install spidermonkey
    https://developer.mozilla.org/En/SpiderMonkey/Build_Documentation

Building
======

Run make. This assembles the dom.js and src/domcore.js files from the other source files in the project.

Testing
======

Run either make test-summary or make test-detailed. The JS_PATH environment variable should be set to the directory that contains the spidermonkey "js" executable, and the JSTESTS_PATH environment variable should be set to the directory that contains jstests.py. Example:

JS_PATH=~/Code/mozilla-central/js/src/build-release JSTESTS_PATH=~/Code/mozilla-central/js/src/tests make test-detailed

About

Self-hosted JavaScript implementation of a WebIDL-compliant HTML5 DOM.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published