Added an extra check for removing a named cache property - calling it when it didn't exist caused an exception.
This commit is contained in:
parent
139b03af7c
commit
cd6ec6e157
16
src/core.js
16
src/core.js
|
@ -509,14 +509,16 @@ jQuery.extend({
|
||||||
|
|
||||||
// If we want to remove a specific section of the element's data
|
// If we want to remove a specific section of the element's data
|
||||||
if ( name ) {
|
if ( name ) {
|
||||||
// Remove the section of cache data
|
if ( jQuery.cache[ id ] ) {
|
||||||
delete jQuery.cache[ id ][ name ];
|
// Remove the section of cache data
|
||||||
|
delete jQuery.cache[ id ][ name ];
|
||||||
|
|
||||||
// If we've removed all the data, remove the element's cache
|
// If we've removed all the data, remove the element's cache
|
||||||
name = "";
|
name = "";
|
||||||
for ( name in jQuery.cache[ id ] ) break;
|
for ( name in jQuery.cache[ id ] ) break;
|
||||||
if ( !name )
|
if ( !name )
|
||||||
jQuery.removeData( elem );
|
jQuery.removeData( elem );
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise, we want to remove all of the element's data
|
// Otherwise, we want to remove all of the element's data
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue