From 9e33007578f1c363e79eb8631b890487fc11c19a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Fri, 2 Aug 2013 15:39:03 +0200 Subject: [PATCH] =?utf8?q?D=C3=A9placement=20de=20'copyPrototype'=20growab?= =?utf8?q?le=5Ftable.js=20->=20javascript=5Fevents=5Fapi.js.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skins/ajax_scripts/growable_table.js | 18 ++++++++++-------- skins/ajax_scripts/javascript_events_api.js | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/skins/ajax_scripts/growable_table.js b/skins/ajax_scripts/growable_table.js index 4ddaaec..b7fcf1f 100644 --- a/skins/ajax_scripts/growable_table.js +++ b/skins/ajax_scripts/growable_table.js @@ -290,11 +290,13 @@ GrowableTable.prototype.cancelRow = function(element) { * http://www.sitepoint.com/blogs/2006/01/17/javascript-inheritance/ */ -function copyPrototype(descendant, parent) { - var sConstructor = parent.toString(); - var aMatch = sConstructor.match( /\s*function (.*)\(/ ); - if ( aMatch != null ) { descendant.prototype[aMatch[1]] = parent; } - for (var m in parent.prototype) { - descendant.prototype[m] = parent.prototype[m]; - } -} +// déplacé dans javascript_events_api.js + +// function copyPrototype(descendant, parent) { +// var sConstructor = parent.toString(); +// var aMatch = sConstructor.match( /\s*function (.*)\(/ ); +// if ( aMatch != null ) { descendant.prototype[aMatch[1]] = parent; } +// for (var m in parent.prototype) { +// descendant.prototype[m] = parent.prototype[m]; +// } +// } diff --git a/skins/ajax_scripts/javascript_events_api.js b/skins/ajax_scripts/javascript_events_api.js index 62ec577..14c6dfe 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/ +*/ + +var 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]; } + } +}; + }()); -- 2.20.1