Commit cd6ec6e1 authored by John Resig's avatar John Resig

Added an extra check for removing a named cache property - calling it when it...

Added an extra check for removing a named cache property - calling it when it didn't exist caused an exception.
parent 139b03af
...@@ -509,6 +509,7 @@ jQuery.extend({ ...@@ -509,6 +509,7 @@ 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 ) {
if ( jQuery.cache[ id ] ) {
// Remove the section of cache data // Remove the section of cache data
delete jQuery.cache[ id ][ name ]; delete jQuery.cache[ id ][ name ];
...@@ -517,6 +518,7 @@ jQuery.extend({ ...@@ -517,6 +518,7 @@ jQuery.extend({
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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment