Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better approach the hasData side effects fix. Thanks gibson042

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information...
commit 73b315538f21cab1118e72402576f3851c555b95 1 parent 5b59a63
Rick Waldron rwaldron authored
Showing with 2 additions and 8 deletions.
  1. +2 −8 src/data.js
10 src/data.js
View
@@ -21,17 +21,11 @@ function Data() {
Data.uid = 1;
Data.prototype = {
- key: function( owner, options ) {
+ key: function( owner ) {
var descriptor = {},
// Check if the owner object already has a cache key
unlock = owner[ this.expando ];
- // `readonly` calls from hasData, on owners with no key
- // should not create new/empty cache records
- if ( !unlock && (options && options.readonly) ) {
- return null;
- }
-
// If not, create one
if ( !unlock ) {
unlock = Data.uid++;
@@ -164,7 +158,7 @@ Data.prototype = {
},
hasData: function( owner ) {
return !jQuery.isEmptyObject(
- this.cache[ this.key( owner, { readonly: true }) ] || {}
+ this.cache[ owner[ this.expando ] ] || {}
);
},
discard: function( owner ) {
Please sign in to comment.
Something went wrong with that request. Please try again.