( elem, name, pvt )
| 3919 | } |
| 3920 | |
| 3921 | function internalRemoveData( elem, name, pvt ) { |
| 3922 | if ( !acceptData( elem ) ) { |
| 3923 | return; |
| 3924 | } |
| 3925 | |
| 3926 | var thisCache, i, |
| 3927 | isNode = elem.nodeType, |
| 3928 | |
| 3929 | // See jQuery.data for more information |
| 3930 | cache = isNode ? jQuery.cache : elem, |
| 3931 | id = isNode ? elem[ jQuery.expando ] : jQuery.expando; |
| 3932 | |
| 3933 | // If there is already no cache entry for this object, there is no |
| 3934 | // purpose in continuing |
| 3935 | if ( !cache[ id ] ) { |
| 3936 | return; |
| 3937 | } |
| 3938 | |
| 3939 | if ( name ) { |
| 3940 | |
| 3941 | thisCache = pvt ? cache[ id ] : cache[ id ].data; |
| 3942 | |
| 3943 | if ( thisCache ) { |
| 3944 | |
| 3945 | // Support array or space separated string names for data keys |
| 3946 | if ( !jQuery.isArray( name ) ) { |
| 3947 | |
| 3948 | // try the string as a key before any manipulation |
| 3949 | if ( name in thisCache ) { |
| 3950 | name = [ name ]; |
| 3951 | } else { |
| 3952 | |
| 3953 | // split the camel cased version by spaces unless a key with the spaces exists |
| 3954 | name = jQuery.camelCase( name ); |
| 3955 | if ( name in thisCache ) { |
| 3956 | name = [ name ]; |
| 3957 | } else { |
| 3958 | name = name.split( " " ); |
| 3959 | } |
| 3960 | } |
| 3961 | } else { |
| 3962 | |
| 3963 | // If "name" is an array of keys... |
| 3964 | // When data is initially created, via ("key", "val") signature, |
| 3965 | // keys will be converted to camelCase. |
| 3966 | // Since there is no way to tell _how_ a key was added, remove |
| 3967 | // both plain key and camelCase key. #12786 |
| 3968 | // This will only penalize the array argument path. |
| 3969 | name = name.concat( jQuery.map( name, jQuery.camelCase ) ); |
| 3970 | } |
| 3971 | |
| 3972 | i = name.length; |
| 3973 | while ( i-- ) { |
| 3974 | delete thisCache[ name[ i ] ]; |
| 3975 | } |
| 3976 | |
| 3977 | // If there is no data left in the cache, we want to continue |
| 3978 | // and let the cache object itself get destroyed |
no test coverage detected