( elem, name, pvt )
| 1643 | } |
| 1644 | |
| 1645 | function internalRemoveData( elem, name, pvt ) { |
| 1646 | if ( !jQuery.acceptData( elem ) ) { |
| 1647 | return; |
| 1648 | } |
| 1649 | |
| 1650 | var i, l, thisCache, |
| 1651 | isNode = elem.nodeType, |
| 1652 | |
| 1653 | // See jQuery.data for more information |
| 1654 | cache = isNode ? jQuery.cache : elem, |
| 1655 | id = isNode ? elem[ jQuery.expando ] : jQuery.expando; |
| 1656 | |
| 1657 | // If there is already no cache entry for this object, there is no |
| 1658 | // purpose in continuing |
| 1659 | if ( !cache[ id ] ) { |
| 1660 | return; |
| 1661 | } |
| 1662 | |
| 1663 | if ( name ) { |
| 1664 | |
| 1665 | thisCache = pvt ? cache[ id ] : cache[ id ].data; |
| 1666 | |
| 1667 | if ( thisCache ) { |
| 1668 | |
| 1669 | // Support array or space separated string names for data keys |
| 1670 | if ( !jQuery.isArray( name ) ) { |
| 1671 | |
| 1672 | // try the string as a key before any manipulation |
| 1673 | if ( name in thisCache ) { |
| 1674 | name = [ name ]; |
| 1675 | } else { |
| 1676 | |
| 1677 | // split the camel cased version by spaces unless a key with the spaces exists |
| 1678 | name = jQuery.camelCase( name ); |
| 1679 | if ( name in thisCache ) { |
| 1680 | name = [ name ]; |
| 1681 | } else { |
| 1682 | name = name.split(" "); |
| 1683 | } |
| 1684 | } |
| 1685 | } else { |
| 1686 | // If "name" is an array of keys... |
| 1687 | // When data is initially created, via ("key", "val") signature, |
| 1688 | // keys will be converted to camelCase. |
| 1689 | // Since there is no way to tell _how_ a key was added, remove |
| 1690 | // both plain key and camelCase key. #12786 |
| 1691 | // This will only penalize the array argument path. |
| 1692 | name = name.concat( jQuery.map( name, jQuery.camelCase ) ); |
| 1693 | } |
| 1694 | |
| 1695 | for ( i = 0, l = name.length; i < l; i++ ) { |
| 1696 | delete thisCache[ name[i] ]; |
| 1697 | } |
| 1698 | |
| 1699 | // If there is no data left in the cache, we want to continue |
| 1700 | // and let the cache object itself get destroyed |
| 1701 | if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { |
| 1702 | return; |
no test coverage detected
searching dependent graphs…