JS DOM Utils, browserify and selective require friendly


A set of DOM utilities, which were first created in cog but have been extracted as cog is more a JS language toolset, and dd is it's DOM counterpart.

As per cog it is designed to be used as in a cherry-picking way rather than by simply requiring dd as a whole module.

The following is a list of modules that dd provides. Examples demonstrate how to require and use them in your code.

This is a simple script loader that will load the urls specified and trigger the callback once all those scripts have been loaded (or loading has failed in one instance).

var loader = require('dd/loader');
var scripts = [
loader(scripts, function() {

This function is used to get the results of the querySelectorAll output in the fastest possible way. This code is very much based on the implementation in zepto, but perhaps not quite as terse.

var qsa = require('dd/qsa');

Request animation frame helper.

var raf = require('dd/raf');
function animate() {
  raf(animate); // go again