diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2012-12-31 18:06:38 -0500 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2012-12-31 18:06:38 -0500 |
commit | f717226b3a44f918eec30b2d59ab257270189bc3 (patch) | |
tree | c1e2e65e7068831c86bd305e794929446c487a9a | |
parent | b9cdc4136b688963d1dc4befb169be02a0216ba9 (diff) | |
download | jquery-f717226b3a44f918eec30b2d59ab257270189bc3.tar.gz jquery-f717226b3a44f918eec30b2d59ab257270189bc3.zip |
Only splice from internal arrays when item actually exists.
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
-rw-r--r-- | src/data.js | 7 |
1 files changed, 5 insertions, 2 deletions
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; } }; |