]> source.dussan.org Git - jquery.git/commitdiff
Better approach the hasData side effects fix. Thanks gibson042
authorRick Waldron <waldron.rick@gmail.com>
Mon, 1 Apr 2013 21:09:37 +0000 (17:09 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Mon, 1 Apr 2013 21:09:37 +0000 (17:09 -0400)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
src/data.js

index 189de6259b2d603118f7ab9a79aa15ee4fc5567c..eedde4d6f719d577d6aca7fbaa27e9e491ddce8e 100644 (file)
@@ -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 ) {