Matt's DOM Utils Matt's DOM Utils (Utils)



Utils is a fully modular DOM library that enables developers to write DOM scripts that gracefully degrade. It has been widely tested in browsers both new and old in order to maximize compatibility.

Quick Facts


Utils is provided under the MIT license, which is provided as a separate file[1]. for viewing. The MIT license was chosen to provide the freedom for developers to use the code in any scenario.


Utils is developed with the following core tenets in mind:

Graceful Degradation;
Code will not execute if an incapable environment is detected. Coupled with defensive programming, this is the most powerful way to write “cross-browser” scripts.
Code is split up into objects with distinctive names which encapsulate internal methods and properties.
Code is split into files with minimal dependencies. This enables developers to easily swap out “modules” that are undesired or irrelevant.
Minimal DOM Abstraction.
API design largely sticks to the nomenclature of the DOM API. This enables a flat learning curve, as developers should be somewhat familiar with the DOM API.


Utils is developed to gracefully degrade in as many environments as possible.

Supported Environments

The following environments have been explicitly tested and passed tests with a 100% grade (permitting sufficient DOM support to run tests):


Utils has been tested in older versions of the above along with miscellaneous environments. Support for the preceding is positive, but not qualitative.

Tests are conducted with a basic subset of the DOM Level 1 Core API. Any environment that does not support the preceding API will then be tested with a basic subset of the “DOM 0” API. ECMAScript language features such as throw and try { ... } catch (err) { ... } are required to evaluate an environment. Environments without these features currently cannot have qualitative testing performed.


Utils is written in a style that's subjectively easy to read and follow. No line of code exceeds 72 columns; every function's body is 251 lines of code or less; each function contains documentation for portability and clarity. Furthermore, the code is intended to be reliable and friendly; zero corners are cut.


Utils passes JSLint with only two options selected: whitespace and "use strict";.

Utils also passes JSHint with only "use strict"; disabled and no environmental assumptions.


Utils is presumed to work well on Chrome versions 4 and up. However, due to Chrome's intrusive installation, only one version can be installed per virtual machine. As only four virtual machines utilized for the testing of Utils can run Chrome, only four versions can be tested.
Utils is authored with a strict ceiling of 20 lines of code per function body, but some difficult cases remain.