___ ___ ___________ ___________ ___ _________
| | | || || || | | |
| | | ||___ ___||___ ___|| | | _____|
| | | | | | | | | | | |_____
| | | | | | | | | | | |
| | | | | | | | | | |_____ |
| \__/ | | | ___| |___ | |_____ _____| |
\ / | | | || || |
\________/ |___| |___________||_________||_________|
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.
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.
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.
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.
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.
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.
- Last edited on Thursday, August 2nd 2012