Hi, I'm using Mootools in a new JS java servlet (using Rhino) that I'm
building and I had the following problem with Class. I used the
example from the documentation to find what I was doing wrong, but
then I found out that the example didn't work too.
Here is what I did, I created a script with the "Extends Example"
inside the Class documentation:
var Animal = new Class({
initialize: function(age){
this.age = age;
}
});
var Cat = new Class({
Extends: Animal,
initialize: function(name, age){
this.parent(age); //will call initalize of Animal
this.name = name;
}
});
logger.debug(JSON.encode(myCat));
logger.debug(myCat.name);
logger.debug(myCat.age);
I changed the alert to output it to a logger that I had but the output
was:
{}
undefined
undefined
Meaning that the object was empty. So I went back to mootools server
side that I downloaded (version 1.2.4) and found that line 891 (delete
object[key];) may have something to do with it. So I commentted it out
and ran it again. After that the result was correct:
{"age":20,"name":"Micia"}
Micia
20
Is this a known bug or something I did wrong?