diff --git a/Foundation/CPArray/_CPJavaScriptArray.j b/Foundation/CPArray/_CPJavaScriptArray.j index edd1292e6..e1fb6b2ac 100644 --- a/Foundation/CPArray/_CPJavaScriptArray.j +++ b/Foundation/CPArray/_CPJavaScriptArray.j @@ -248,14 +248,19 @@ var concat = Array.prototype.concat, - (void)removeObjectIdenticalTo:(id)anObject { - var anIndex = indexOf.call(self, anObject); - if (anIndex !== -1) - splice.call(self, anIndex, 1); + if (indexOf) + { + var anIndex; + if ((anIndex = indexOf.call(self, anObject)) !== -1) + splice.call(self, anIndex, 1); + } + else + [super removeObjectIdenticalTo:anObject inRange:CPMakeRange(0, self.length)]; } - (void)removeObjectIdenticalTo:(id)anObject inRange:(CPRange)aRange { - if (!aRange) + if (indexOf && !aRange) [self removeObjectIdenticalTo:anObject]; [super removeObjectIdenticalTo:anObject inRange:aRange];