A toolbox of HTML DOM utilities.
JavaScript Shell Other
Latest commit 9cc9d5d Aug 2, 2012 @mkmcdonald COMPLETED:
1. Updated event docs to include detection warnings.


1. Get more peer reviews;
2. Ponder ways to remove repetition;
3. Add Safari 1-2 to test browsers (Mac OS X);
4. Add Chrome 5+ to test browsers (???);
5. Ponder ways to support IE 4;
6. Ponder ways to truncate syntax;
7. Maintain a live change log so commit messages can be
	more accurate.


Failed to load latest commit information.
Assets COMPLETED: Jun 28, 2012
Builds COMPLETED: Aug 2, 2012
Docs COMPLETED: Aug 2, 2012
Download COMPLETED: Aug 2, 2012
Library COMPLETED: Aug 2, 2012
Templates COMPLETED: Jun 27, 2012
Tests COMPLETED: Aug 2, 2012
Makefile COMPLETED: Aug 2, 2012
README.md COMPLETED: Aug 2, 2012
README.md.in COMPLETED: Aug 2, 2012
about.html COMPLETED: Jun 21, 2012
about.html.in COMPLETED: Jun 21, 2012
build.sh COMPLETED: Aug 2, 2012
compress.sh COMPLETED: Aug 2, 2012
configure.ac COMPLETED: Aug 2, 2012
favicon.ico COMPLETED: Jun 5, 2012
index.html COMPLETED: Jun 25, 2012
index.html.in COMPLETED: Jun 25, 2012
yui-compressor.jar COMPLETED: Jun 25, 2012


     ___      ___  ___________  ___________  ___        _________
    |   |    |   ||           ||           ||   |      |         |
    |   |    |   ||___     ___||___     ___||   |      |    _____|
    |   |    |   |    |   |        |   |    |   |      |   |_____
    |   |    |   |    |   |        |   |    |   |      |         |
    |   |    |   |    |   |        |   |    |   |      |_____    |
    |    \__/    |    |   |     ___|   |___ |   |_____  _____|   |
     \          /     |   |    |           ||         ||         |
      \________/      |___|    |___________||_________||_________|

    Matt's DOM Utils


    A collection of widely tested DOM modules that work in a
    maximal amount of environments.


    Matt McDonald

    Twitter: @mattsdomutils.
    IRC: #mattsdomutils (irc://irc.freenode.net)

    Current Build Order:

    (optional modules)
    * raise.js
    * types.js;
    * is.js;
    * node.js;
    * create.js;
    * classes.js;
    * traverse.js;
    * text.js;
    * ancestors.js;
    * select.js;
    * event.js.

Matt's DOM Utils (Utils)

Utils is a toolbox for the HTML DOM. By minimally wrapping the DOM, it enables developers to learn about the API without the fog of heavy abstractions.


Utils is licensed under the MIT License. In concordance with the MIT License, use the provided source code under any scenario.

Optional Modules


Utils provides error messages based upon the DOM 4 spec. Each documented error type has a method provided to "raise" (throw) the corresponding error.


Utils provides an object containing every specified nodeType based upon the DOM 4 spec.


Utils provides identification tests. These include tests for document tree node-like objects as well as "host objects". Utilising these tests allows scripts to degrade gracefully.


Utils provides a set of wrappers for various methods of of the Node interface. In particular, this includes Node::appendChild and Node::removeChild.

See ./Tests/Node for examples.


Utils provides a set of wrappers for various methods of creation. In particular, this includes Node::createElement and Node::createTextNode.

See ./Tests/Create for examples.


Utils provides a DOM Level 4 spec-style Element::classList implementation. This includes methods for testing, adding, removing and retrieving class tokens.

See ./Tests/Classes for examples.


Utils's main focus is diverse DOM traversal. This includes utilities for Node::childNodes, Node::children and text along with more general methods of traversal.

See ./Tests/Traverse for examples.


Utils provides a DOM Level 4 spec-style Node::textContent implementation. This includes methods for getting and setting text.

See ./Tests/Text for examples.


Utils provides various methods for traversal of document tree ancestors.

See ./Tests/Ancestors for examples.


Utils provides a set of wrappers for various methods of selection. This includes popular methods such as Document::getElementById, getElementsByTagName and newer methods such as NodeSelector::querySelectorAll.

See ./Tests/Select for examples.


Utils provides a set of methods to add event listeners for both the DOM Level 2+ and MSHTML event models alongside methods to bind and unbind event handlers.

See ./Tests/Event for examples.


Utils provides a configure.ac file, which resonates thoughout the entire project tree.


Utils provides a configure.ac file, which can be edited to amend the project tree. In order to compile it, GNU Autotools (specifically autoconf) must be available to the system.

Project Name

A Bash variable is utilised in order to build the entire project tree under a variable name. This can then be edited in the configure.ac file, and then compiled into the configure script.

To use a custom project name, find the following snippet in configure.ac:

    # your library name here


and amend the LIBRARY_NAME variable's value to another string value.

Then, call the following command:


in the project root to create a configure script from the file.

Finally, run the configure script by calling:


in the project root. This will echo the changes to the configure.ac file throughout the project tree.


Utils provides some simple options for build creation via ./Makefile.


make head (exports to ./Builds/Uncompressed/utils-head.js). This contains the license and global variables.


make complete (exports to ./Builds/Uncompressed/utils-complete.js).


make compress (runs all hard-coded builds through the YUI Compressor to ./Builds/Compressed).


make or make all will run all of the above options.

Custom Builds

Utils provides multiple options for custom builds.


./build.sh [modules] will pass the specified modules to the build script and will then export the result to ./Builds/Uncompressed/utils-build.js.


./build.sh traverse text


A server-side builder is located at the project site, which provides an easy way to string together files for those who cannot or do not wish to run command-line code.




Analyses and Advice


  • Last edited on Thursday, August 2nd 2012