I'm working on a legacy product and introducing prototype to make my life a little easier and I'm running into some problems with the properties being added to some built in objects like Array.
The product has a form validator that's used all over that adds fields (and some of the fields properties) that need to be checked to an array called fields (edited for simplicity): /* ***************** */ fields = new Array(); fields[pFieldName] = new Field(pFieldName, name); /* ***************** */ Later on when it's validating this field it does something like this: /* ***************** */ for(var currentField in fields) { if(!fields[currentField].validate()) { isValid = false; } } /* ***************** */ The previous developer used a for in loop to go through all the fields in his array and run the validate method on each one... The problem is there is a ton of extra methods in the object because prototype adds all that ennumerable goodness to new Array objects. I tried to go through and delete everything after making the array: fields = new Array(); for(var i in this.fields) { delete this.fields[i]; } which works in IE but not Firefox, plus it seems like it's not very elegant. To make matters worse, for the time being, not every page that uses the validator will have prototype linked in. So, I can't make changes to the validator that will break everything if prototype isn't on the page. Any ideas how I can get these scripts to play nice? Thanks in advance, Jason _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs