From: Derk-Jan Hartman Date: Tue, 12 Oct 2010 19:15:40 +0000 (+0000) Subject: * Test for the presence of addEventListener on the element on which we will actually... X-Git-Tag: 1.31.0-rc.0~34531 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/voir.php?a=commitdiff_plain;h=50f8f5a6319796aae9765b8108a8ae7fa2bfc532;p=lhc%2Fweb%2Fwiklou.git * Test for the presence of addEventListener on the element on which we will actually use it. Just in case someone messes with the normal environment. --- diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index e5b835e5ff..3b582dd954 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -1056,9 +1056,9 @@ window.runOnloadHook = function() { * @param callable handler Event handler callback */ window.addHandler = function( element, attach, handler ) { - if( window.addEventListener ) { + if( element.addEventListener ) { element.addEventListener( attach, handler, false ); - } else if( window.attachEvent ) { + } else if( element.attachEvent ) { element.attachEvent( 'on' + attach, handler ); } }