( elem, name, pvt )
| 3770 | } |
| 3771 | |
| 3772 | function internalRemoveData( elem, name, pvt ) { |
| 3773 | if ( !jQuery.acceptData( elem ) ) { |
| 3774 | return; |
| 3775 | } |
| 3776 | |
| 3777 | var thisCache, i, |
| 3778 | isNode = elem.nodeType, |
| 3779 | |
| 3780 | // See jQuery.data for more information |
| 3781 | cache = isNode ? jQuery.cache : elem, |
| 3782 | id = isNode ? elem[ jQuery.expando ] : jQuery.expando; |
| 3783 | |
| 3784 | // If there is already no cache entry for this object, there is no |
| 3785 | // purpose in continuing |
| 3786 | if ( !cache[ id ] ) { |
| 3787 | return; |
| 3788 | } |
| 3789 | |
| 3790 | if ( name ) { |
| 3791 | |
| 3792 | thisCache = pvt ? cache[ id ] : cache[ id ].data; |
| 3793 | |
| 3794 | if ( thisCache ) { |
| 3795 | |
| 3796 | // Support array or space separated string names for data keys |
| 3797 | if ( !jQuery.isArray( name ) ) { |
| 3798 | |
| 3799 | // try the string as a key before any manipulation |
| 3800 | if ( name in thisCache ) { |
| 3801 | name = [ name ]; |
| 3802 | } else { |
| 3803 | |
| 3804 | // split the camel cased version by spaces unless a key with the spaces exists |
| 3805 | name = jQuery.camelCase( name ); |
| 3806 | if ( name in thisCache ) { |
| 3807 | name = [ name ]; |
| 3808 | } else { |
| 3809 | name = name.split(" "); |
| 3810 | } |
| 3811 | } |
| 3812 | } else { |
| 3813 | // If "name" is an array of keys... |
| 3814 | // When data is initially created, via ("key", "val") signature, |
| 3815 | // keys will be converted to camelCase. |
| 3816 | // Since there is no way to tell _how_ a key was added, remove |
| 3817 | // both plain key and camelCase key. #12786 |
| 3818 | // This will only penalize the array argument path. |
| 3819 | name = name.concat( jQuery.map( name, jQuery.camelCase ) ); |
| 3820 | } |
| 3821 | |
| 3822 | i = name.length; |
| 3823 | while ( i-- ) { |
| 3824 | delete thisCache[ name[i] ]; |
| 3825 | } |
| 3826 | |
| 3827 | // If there is no data left in the cache, we want to continue |
| 3828 | // and let the cache object itself get destroyed |
| 3829 | if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { |
no test coverage detected