patrickkunka/easydropdown — pull request #66 by Francis-Underwood (2014-07-30 07:22:22+00:00)
Title: Check more when iterating through the 'instances' array

Hi Patrick,

This is just a great utility, thank you for your work.

May I suggest the following change:

closeAll: function(){
var self = this,
instances = Object.getPrototypeOf(self).instances;

for(var key in instances){
if (instances.hasOwnProperty(key)) {
var instance = instances[key];
instance.close();
}
};
},

In case that people extend built-in Array's functionality by attaching a method to Array.prototype, then the method will show up inside this for loop as the local 'instance' variable, and then invoking close() on it will certainly arise an error.

FYR:http://stackoverflow.com/questions/1107681/javascript-hiding-prototype-methods-in-for-loop

Thank you.

Vincent