Skip to content

developer instructions

Raynos edited this page Oct 29, 2011 · 3 revisions

Compiling

To be able to build the "compiled" DOM-shim.js file in lib you will need a copy of node.js (I use 0.5.9 on windows).

node.exe DOM-shim/build.js

Should compile the parts of the DOM-shim in src/ into lib/DOM-shim.js. It will also compile the test-suites into the test.html file.

Running unit tests

After building the project the unit test should be in test/test.html. This should run all the tests defined in the test/test-suites folder.

Adding shims for interfaces.

Adding a shim for an interface involves adding a folder for the Interface if it doesn't exist in the interfaces folder. Then depending on whether the shim is a constant, property/method or getter/setter you should create a constants/getter/props folder.

Inside the constants folder just add a js file (start.js) that adds constants to the interface.

Inside the props/getter folder you should create a new file for the property/method/attribute your adding and inside the file you should add your property to either domShim.getters[Interface][getterName] or domShim.props[Interface][propName]

If your adding a new Interface make sure you adjust src/start.js to add the interface object to domShim[Interface] including sensible defaults for the interface and the prototype.

Every file is wrapped in a closure which only has access to domShim. If you need shared content you will need to add it to start.js file somewhere (either the top level one like src/start.js or a common one like src/interfaces/Node/getter/start.js).

Fixing browser bugs

Any browser bugs should (for now) be added to src/bugs.js. Here we do feature detection for the bug and then patch the DOM if it's broken (bugged).

start.js and end.js

The build script makes sure the start.js file is concatenated first, and the end.js is concatenated last. All the other files are in "random" order.

RAYNOS Y U NO COMMENT

There are barely any comments in the code. Apart from comments in the bugs file explaining which browser is bugged and why (vaguely why). If anything needs proper commenting or something is clearly black magic raise an issue.

Clone this wiki locally