jsonml-html.js
function(elem, name, handler) {
		if (name.substr(0,2) === 'on') {
			name = name.substr(2);
		}

		switch (typeof handler) {
			case 'function':
				if (elem.addEventListener) {
					// DOM Level 2
					elem.addEventListener(name, handler, false);

				} else if (elem.attachEvent && getType(elem[name]) !== NUL) {
					// IE legacy events
					elem.attachEvent('on'+name, handler);

				} else {
					// DOM Level 0
					var old = elem['on'+name] || elem[name];
					elem['on'+name] = elem[name] = !isFunction(old) ? handler :
						function(e) {
							return (old.call(this, e) !== false) && (handler.call(this, e) !== false);
						};
				}
				break;

			case 'string':
				// inline functions are DOM Level 0
				/*jslint evil:true */
				elem['on'+name] = new Function('event', handler);
				/*jslint evil:false */
				break;
		}
	}
function(elem, name, handler) {
		if (name.substr(0,2) === 'on') {
			name = name.substr(2);
		}

		switch (typeof handler) {
			case 'function':
				if (elem.addEventListener) {
					// DOM Level 2
					elem.addEventListener(name, handler, false);

				} else if (elem.attachEvent && getType(elem[name]) !== NUL) {
					// IE legacy events
					elem.attachEvent('on'+name, handler);

				} else {
					// DOM Level 0
					var old = elem['on'+name] || elem[name];
					elem['on'+name] = elem[name] = !isFunction(old) ? handler :
						function(e) {
							return (old.call(this, e) !== false) && (handler.call(this, e) !== false);
						};
				}
				break;

			case 'string':
				// inline functions are DOM Level 0
				/*jslint evil:true */
				elem['on'+name] = new Function('event', handler);
				/*jslint evil:false */
				break;
		}
	}
function ( elem , name , handler ) { if ( name . substr ( 0 , 2 ) === 'on' ) { name = name . substr ( 2 ) ; } switch ( typeof handler ) { case 'function' : if ( elem . addEventListener ) { // DOM Level 2
 elem . addEventListener ( name , handler , false ) ; } else if ( elem . attachEvent && getType ( elem [ name ] ) !== NUL ) { // IE legacy events
 elem . attachEvent ( 'on' + name , handler ) ; } else { // DOM Level 0
 var old = elem [ 'on' + name ] || elem [ name ] ; elem [ 'on' + name ] = elem [ name ] = ! isFunction ( old ) ? handler : function ( e ) { return ( old . call ( this , e ) !== false ) && ( handler . call ( this , e ) !== false ) ; } ; } break ; case 'string' : // inline functions are DOM Level 0
 /*jslint evil:true */ elem [ 'on' + name ] = new Function ( 'event' , handler ) ; /*jslint evil:false */ break ; } }
Adds an event handler to an element

@private
@param {Node} elem The element
@param {string} name The event name
@param {function(Event)} handler The event handler
Adds an event handler to an element