J'essaie de déboguer le bloc suivant de code Javascript pour voir quel est le problème. J'obtiens une erreur qui indique "Membre non trouvé" sur la ligne Javascript "Membre introuvable" erreur dans IE8
constructor = function() {dans la méthode extend: function().
Je ne suis pas très bon avec Javascript, et je n'ai pas écrit cela, donc je suis un peu perdu sur ce que le problème est. L'erreur se produit uniquement dans IE8, cela fonctionne très bien dans IE7 et Firefox.
var Class = {
create: function() {
return function() {
if(this.destroy) Class.registerForDestruction(this);
if(this.initialize) this.initialize.apply(this, arguments);
}
},
extend: function(baseClassName) {
constructor = function() {
var i;
this[baseClassName] = {}
for(i in window[baseClassName].prototype) {
if(!this[i]) this[i] = window[baseClassName].prototype[i];
if(typeof window[baseClassName].prototype[i] == 'function') {
this[baseClassName][i] = window[baseClassName].prototype[i].bind(this);
}
}
if(window[baseClassName].getInheritedStuff) {
window[baseClassName].getInheritedStuff.apply(this);
}
if(this.destroy) Class.registerForDestruction(this);
if(this.initialize) this.initialize.apply(this, arguments);
}
constructor.getInheritedStuff = function() {
this[baseClassName] = {}
for(i in window[baseClassName].prototype) {
if(!this[i]) this[i] = window[baseClassName].prototype[i];
if(typeof window[baseClassName].prototype[i] == 'function') {
this[baseClassName][i] = window[baseClassName].prototype[i].bind(this);
}
}
if(window[baseClassName].getInheritedStuff) {
window[baseClassName].getInheritedStuff.apply(this);
}
}
return constructor;
},
objectsToDestroy : [],
registerForDestruction: function(obj) {
if(!Class.addedDestructionLoader) {
Event.observe(window, 'unload', Class.destroyAllObjects);
Class.addedDestructionLoader = true;
}
Class.objectsToDestroy.push(obj);
},
destroyAllObjects: function() {
var i,item;
for(i=0;item=Class.objectsToDestroy[i];i++) {
if(item.destroy) item.destroy();
}
Class.objectsToDestroy = null;
}
}
Eh bien qu'est-ce que tu sais, c'était tout! Merci beaucoup. – Steven