Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A toolbox of HTML DOM utilities.

branch: master

COMPLETED:

1. Updated event docs to include detection warnings.

TODO:

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.

TESTS:

(null)
latest commit 9cc9d5d393
Matt McDonald authored August 02, 2012
Octocat-spinner-32 Assets COMPLETED: June 27, 2012
Octocat-spinner-32 Builds COMPLETED: August 02, 2012
Octocat-spinner-32 Demos COMPLETED: June 25, 2012
Octocat-spinner-32 Docs COMPLETED: August 02, 2012
Octocat-spinner-32 Download COMPLETED: August 02, 2012
Octocat-spinner-32 Library COMPLETED: August 02, 2012
Octocat-spinner-32 Templates COMPLETED: June 27, 2012
Octocat-spinner-32 Tests COMPLETED: August 02, 2012
Octocat-spinner-32 .gitignore COMPLETED: June 04, 2012
Octocat-spinner-32 LICENSE COMPLETED: June 22, 2012
Octocat-spinner-32 Makefile COMPLETED: August 02, 2012
Octocat-spinner-32 README.md COMPLETED: August 02, 2012
Octocat-spinner-32 README.md.in COMPLETED: August 02, 2012
Octocat-spinner-32 about.html COMPLETED: June 20, 2012
Octocat-spinner-32 about.html.in COMPLETED: June 20, 2012
Octocat-spinner-32 build.sh COMPLETED: August 02, 2012
Octocat-spinner-32 compress.sh COMPLETED: August 02, 2012
Octocat-spinner-32 configure COMPLETED: August 02, 2012
Octocat-spinner-32 configure.ac COMPLETED: August 02, 2012
Octocat-spinner-32 favicon.ico COMPLETED: June 04, 2012
Octocat-spinner-32 index.html COMPLETED: June 25, 2012
Octocat-spinner-32 index.html.in COMPLETED: June 25, 2012
Octocat-spinner-32 yui-compressor.jar COMPLETED: June 24, 2012
README.md
     ___      ___  ___________  ___________  ___        _________
    |   |    |   ||           ||           ||   |      |         |
    |   |    |   ||___     ___||___     ___||   |      |    _____|
    |   |    |   |    |   |        |   |    |   |      |   |_____
    |   |    |   |    |   |        |   |    |   |      |         |
    |   |    |   |    |   |        |   |    |   |      |_____    |
    |    \__/    |    |   |     ___|   |___ |   |_____  _____|   |
     \          /     |   |    |           ||         ||         |
      \________/      |___|    |___________||_________||_________|


    Matt's DOM Utils
    http://www.fortybelow.ca/Projects/JavaScript/Utils/

    Description:

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

    Contact:

    Matt McDonald
    ["Utils".toLowerCase();]@fortybelow.ca
    http://www.fortybelow.ca

    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.

License

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


Optional Modules

Raise

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

Types

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

Is

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.

Node

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.

Create

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.

Classes

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.

Traverse

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.

Text

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

See ./Tests/Text for examples.

Ancestors

Utils provides various methods for traversal of document tree ancestors.

See ./Tests/Ancestors for examples.

Select

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.

Event

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.


Builds

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

Configuration

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

    AC_SUBST(LIBRARY_NAME)
    LIBRARY_NAME="Utils";

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

Then, call the following command:

    autoconf

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

Finally, run the configure script by calling:

    ./configure

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

Makefile

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

Head

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

Complete

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

Minified

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

All

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

Custom Builds

Utils provides multiple options for custom builds.

Command-Line

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

Example

./build.sh traverse text

Server-Side

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.


Attributions

Creator

Inspiration

Analyses and Advice

Metadata

  • Last edited on Thursday, August 2nd 2012
Something went wrong with that request. Please try again.