This seems to work, declaring the array new in the initialize event. Would
love to find out if this behavior is expected or not. Seems like an issue,
but then there is always the chance that some jscript guru explains the
reason for this.
var base = Class.create({
collection: [],
itterations:0,
initialize: function(item) {
this.itterations++;
this.collection = new Array();
this.collection.push(item);
console.log('Itterations: %s, Number items in Collection: %s',
this.itterations, this.collection.size());
}
});
var foo = Class.create(base, {});
var bar = Class.create(base, {});
var _foo = new foo('foo'); // expecting ==> Itterations: 1, Number items in
Collection: 1
var _bar = new bar('bar'); // expecting ==> Itterations: 1, Number items in
Collection: 1
// Actual results for _bar ==> Itterations: 1, Number items in Collection: 2
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/prototype-scriptaculous/-/QwBaGVluQeAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.