function ( a, // Node to delegate event to (I.E. document) b, // Event to delegate (I.E. "click") c, // Event handler function. d, // CSS selectors to match the target child nodes. e, // [optional] data to pass on to event handler. f // (placeholder) ) { f = a[ // Cache old event. b = "on" + b // Prepend "on" to event name. ]; a[b] = function (g) { // Set event to new function. if (g.target.matches(d)) // If we have a match for the selector c.call(g.target, g, e); // then call the event handler and pass on event and data. f ? f(g) : 0 // Chain call the cached event if there was one. } }