Anne van Kesteren

Improving the DOM

Since we gained control of the DOM specification (by working on it) we are starting to improve the DOM too. Libraries are great, and we have to work out the balance between adding convenience APIs at the platform level and the library level, but making things a little easier at the core is worth it I think. Paving cowpaths, you know.

It has been through several iterations, started by Ojan Vafai; here is the latest: “Improving the DOM; rev 2”. These are the kind of operations we want to allow:

Passing in a string maps to the creation of a Text node. remove() removes the node. append() inserts the nodes at the end of the node operated on, prepend() at the start. before() inserts nodes before the node, after() after. replace() replaces the node operated on with some other nodes. It’s not rocket science and actually rather elegant, considering this the DOM. One of the lesser liked parts of web development.

Feedback appreciated!