Merge pull request #60 from gauntface/master

Prevent the defineProperty being called when property already exists
This commit is contained in:
Marak 2013-08-21 14:06:43 -07:00
commit d26602a2d7

View File

@ -50,11 +50,13 @@ var addProperty = function (color, func) {
};
if (Object.defineProperty) {
if(!String.prototype.hasOwnProperty(color)) {
Object.defineProperty(String.prototype, color, {
get : func,
configurable: true,
enumerable: false
});
}
} else {
String.prototype.__defineGetter__(color, func);
}