From: Rick Waldron Date: Mon, 31 Dec 2012 23:06:38 +0000 (-0500) Subject: Only splice from internal arrays when item actually exists. X-Git-Tag: 2.0.0b1~51 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f717226b3a44f918eec30b2d59ab257270189bc3;p=jquery.git Only splice from internal arrays when item actually exists. Signed-off-by: Rick Waldron --- diff --git a/src/data.js b/src/data.js index 6e1465b3b..e6915e9b8 100644 --- a/src/data.js +++ b/src/data.js @@ -122,8 +122,11 @@ Data.prototype = { }, discard: function( owner ) { var index = this.owners.indexOf( owner ); - this.owners.splice( index, 1 ); - this.cache.splice( index, 1 ); + + if ( index >= 0 ) { + this.owners.splice( index, 1 ); + this.cache.splice( index, 1 ); + } return this; } };