X-Git-Url: https://scm.cri.mines-paristech.fr/git/Plinn.git/blobdiff_plain/b3b52f5b0ad754fd9036f816d0ab8e98a5373f40..3b944bb939d2bfffbfcd9dec2356ab284bd3dfae:/skins/ajax_scripts/javascript_events_api.js diff --git a/skins/ajax_scripts/javascript_events_api.js b/skins/ajax_scripts/javascript_events_api.js index 712a44f..71baec7 100644 --- a/skins/ajax_scripts/javascript_events_api.js +++ b/skins/ajax_scripts/javascript_events_api.js @@ -1,8 +1,8 @@ // (c) Benoît PIN 2006-2009 // http://plinn.org // Licence GPL -// $Id: javascript_events_api.js 1535 2009-10-21 16:56:13Z pin $ -// $URL: http://svn.cri.ensmp.fr/svn/Plinn/branches/CMF-2.1/skins/ajax_scripts/javascript_events_api.js $ +// +// // Meta functions for events management. var addListener; /* (ob, eventName, listenerFunction, group) add event listener eventName without "on" prefix. @@ -26,6 +26,7 @@ var getCopyOfNode; /* (node) returns a clone of the given node. * the node came from a foreign document (eg. XmlHttpRequest xml reponse) * to inject HMTL code inside tags where innerHtml is read only (IE) */ +var copyPrototype; // (descendant, parent) lightwheight javascript inheritance (function(){ @@ -61,11 +62,11 @@ function _build_addListener() { var common = function(ob, eventName, listenerFunction, group) { _browserSpecific(ob, eventName, listenerFunction); if (group) { - if(!__groupListeners[group]) - __groupListeners[group] = new Array(); + if(!__groupListeners[group]) { + __groupListeners[group] = [];} __groupListeners[group].push([ob, eventName, listenerFunction]); } - } + }; return common; } @@ -74,33 +75,33 @@ function _build_removeListener() { var _ie_removeListener = function(ob, eventName, listenerFunction) { eventName = "on" + eventName; ob.detachEvent(eventName, listenerFunction); - } + }; return _ie_removeListener; } else if (browser.isDOM2Event) { var _dom2_removeListener = function(ob, eventName, listenerFunction) { ob.removeEventListener(eventName, listenerFunction, false); // only bubbling events :-( - } + }; return _dom2_removeListener; } } removeGroupListeners = function(group) { var listeners = __groupListeners[group]; - var l; - for (var i=0 ; i