MCPcopy Create free account
hub / github.com/Yaffle/EventSource / addEvent

Function addEvent

tests/qunit.js:1101–1115  ·  view source on GitHub ↗

* @param {HTMLElement} elem * @param {string} type * @param {Function} fn

( elem, type, fn )

Source from the content-addressed store, hash-verified

1099 * @param {Function} fn
1100 */
1101function addEvent( elem, type, fn ) {
1102 if ( elem.addEventListener ) {
1103
1104 // Standards-based browsers
1105 elem.addEventListener( type, fn, false );
1106 } else if ( elem.attachEvent ) {
1107
1108 // support: IE <9
1109 elem.attachEvent( "on" + type, fn );
1110 } else {
1111
1112 // Caller must ensure support for event listeners is present
1113 throw new Error( "addEvent() was called in a context without event listener support" );
1114 }
1115}
1116
1117/**
1118 * @param {Array|NodeList} elems

Callers 2

qunit.jsFile · 0.85
addEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected