Commits

Anonymous committed 1b6be73

No ticket: Squeeze data

Comments (0)

Files changed (1)

 		return unlock;
 	},
 	set: function( owner, data, value ) {
-		var prop, cache, unlock;
-
-		// There may be an unlock assigned to this node,
-		// if there is no entry for this "owner", create one inline
-		// and set the unlock as though an owner entry had always existed
-		unlock = this.key( owner );
-		cache = this.cache[ unlock ];
+		var prop,
+			// There may be an unlock assigned to this node,
+			// if there is no entry for this "owner", create one inline
+			// and set the unlock as though an owner entry had always existed
+			unlock = this.key( owner ),
+			cache = this.cache[ unlock ];
 
 		// Handle: [ owner, key, value ] args
 		if ( typeof data === "string" ) {
 
 		// Handle: [ owner, { properties } ] args
 		} else {
-			// [*] In the case where there was actually no "owner" entry and
-			// this.key( owner ) was called to create one, there will be
-			// a corresponding empty plain object in the cache.
-			//
-			// Note, this will kill the reference between
+			// Support an expectation from the old data system where plain
+			// objects used to initialize would be set to the cache by
+			// reference, instead of having properties and values copied.
+			// Note, this will kill the connection between
 			// "this.cache[ unlock ]" and "cache"
 			if ( jQuery.isEmptyObject( cache ) ) {
-				cache = data;
+				this.cache[ unlock ] = data;
 			// Otherwise, copy the properties one-by-one to the cache object
 			} else {
 				for ( prop in data ) {
 			}
 		}
 
-		// [*] This is required to support an expectation made possible by the old
-		// data system where plain objects used to initialize would be
-		// set to the cache by reference, instead of having properties and
-		// values copied.
-		this.cache[ unlock ] = cache;
-
 		return this;
 	},
 	get: function( owner, key ) {
 		return value !== undefined ? value : key;
 	},
 	remove: function( owner, key ) {
-		var i, l, name,
+		var i, name,
 				unlock = this.key( owner ),
 				cache = this.cache[ unlock ];
 
 		if ( key === undefined ) {
-			cache = {};
+			this.cache[ unlock ] = {};
 		} else {
-			if ( cache ) {
-				// Support array or space separated string of keys
-				if ( !Array.isArray( key ) ) {
-					// Try the string as a key before any manipulation
-					if ( key in cache ) {
-						name = [ key ];
-					} else {
-						// If a key with the spaces exists, use it.
-						// Otherwise, create an array by matching non-whitespace
-						name = jQuery.camelCase( key );
-						name = name in cache ?
-							[ name ] : ( name.match( core_rnotwhite ) || [] );
-					}
+			// Support array or space separated string of keys
+			if ( jQuery.isArray( key ) ) {
+				// If "name" is an array of keys...
+				// When data is initially created, via ("key", "val") signature,
+				// keys will be converted to camelCase.
+				// Since there is no way to tell _how_ a key was added, remove
+				// both plain key and camelCase key. #12786
+				// This will only penalize the array argument path.
+				name = key.concat( key.map( jQuery.camelCase ) );
+			} else {
+				// Try the string as a key before any manipulation
+				if ( key in cache ) {
+					name = [ key ];
 				} else {
-					// If "name" is an array of keys...
-					// When data is initially created, via ("key", "val") signature,
-					// keys will be converted to camelCase.
-					// Since there is no way to tell _how_ a key was added, remove
-					// both plain key and camelCase key. #12786
-					// This will only penalize the array argument path.
-					name = key.concat( key.map( jQuery.camelCase ) );
+					// If a key with the spaces exists, use it.
+					// Otherwise, create an array by matching non-whitespace
+					name = jQuery.camelCase( key );
+					name = name in cache ?
+						[ name ] : ( name.match( core_rnotwhite ) || [] );
 				}
-				i = 0;
-				l = name.length;
+			}
 
-				for ( ; i < l; i++ ) {
-					delete cache[ name[i] ];
-				}
+			i = name.length;
+			while ( i-- ) {
+				delete cache[ name[i] ];
 			}
 		}
-		this.cache[ unlock ] = cache;
 	},
 	hasData: function( owner ) {
 		return !jQuery.isEmptyObject(
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.