mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Fixes #13815: Ensure each element has its own private data object - Tests by @rwldrn
This commit is contained in:
@@ -90,13 +90,9 @@ Data.prototype = {
|
||||
|
||||
// Handle: [ owner, { properties } ] args
|
||||
} else {
|
||||
// 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"
|
||||
// Fresh assignments by object are shallow copied
|
||||
if ( jQuery.isEmptyObject( cache ) ) {
|
||||
this.cache[ unlock ] = data;
|
||||
jQuery.extend( this.cache[ unlock ], data );
|
||||
// Otherwise, copy the properties one-by-one to the cache object
|
||||
} else {
|
||||
for ( prop in data ) {
|
||||
@@ -104,6 +100,7 @@ Data.prototype = {
|
||||
}
|
||||
}
|
||||
}
|
||||
return cache;
|
||||
},
|
||||
get: function( owner, key ) {
|
||||
// Either a valid cache is found, or will be created.
|
||||
|
||||
Reference in New Issue
Block a user