X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/a4472c3553470a19942bc35471fcb9f490c534d3..3347d1ecb6dba47bdbdb9d94a1597715b04a9089:/skins/ajax_scripts/javascript_events_api.js?ds=inline diff --git a/skins/ajax_scripts/javascript_events_api.js b/skins/ajax_scripts/javascript_events_api.js index 62ec577..71baec7 100644 --- a/skins/ajax_scripts/javascript_events_api.js +++ b/skins/ajax_scripts/javascript_events_api.js @@ -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(){ @@ -297,4 +298,19 @@ else { _setAttribute = function(e, name, value) {e.setAttribute(name, value);}; } +/* +* http://www.sitepoint.com/blogs/2006/01/17/javascript-inheritance/ +*/ + +copyPrototype = function (descendant, parent) { + var sConstructor = parent.toString(); + var aMatch = sConstructor.match( /\s*function (.*)\(/ ); + if ( aMatch !== null ) { descendant.prototype[aMatch[1]] = parent; } + var m; + for (m in parent.prototype) { + if (parent.prototype.hasOwnProperty(m)) { + descendant.prototype[m] = parent.prototype[m]; } + } +}; + }());