Coder Social home page Coder Social logo

dom.js's Introduction

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

dom.js's People

Contributors

fzzzy avatar taustin avatar andreasgal avatar davidflanagan avatar

Stargazers

我才12岁 avatar

Watchers

我才12岁 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.