( elem, name, pvt /* For internal use only */ )
| 1617 | } |
| 1618 | |
| 1619 | function internalRemoveData( elem, name, pvt /* For internal use only */ ){ |
| 1620 | if ( !jQuery.acceptData( elem ) ) { |
| 1621 | return; |
| 1622 | } |
| 1623 | |
| 1624 | var thisCache, i, l, |
| 1625 | |
| 1626 | isNode = elem.nodeType, |
| 1627 | |
| 1628 | // See jQuery.data for more information |
| 1629 | cache = isNode ? jQuery.cache : elem, |
| 1630 | id = isNode ? elem[ jQuery.expando ] : jQuery.expando; |
| 1631 | |
| 1632 | // If there is already no cache entry for this object, there is no |
| 1633 | // purpose in continuing |
| 1634 | if ( !cache[ id ] ) { |
| 1635 | return; |
| 1636 | } |
| 1637 | |
| 1638 | if ( name ) { |
| 1639 | |
| 1640 | thisCache = pvt ? cache[ id ] : cache[ id ].data; |
| 1641 | |
| 1642 | if ( thisCache ) { |
| 1643 | |
| 1644 | // Support array or space separated string names for data keys |
| 1645 | if ( !jQuery.isArray( name ) ) { |
| 1646 | |
| 1647 | // try the string as a key before any manipulation |
| 1648 | if ( name in thisCache ) { |
| 1649 | name = [ name ]; |
| 1650 | } else { |
| 1651 | |
| 1652 | // split the camel cased version by spaces unless a key with the spaces exists |
| 1653 | name = jQuery.camelCase( name ); |
| 1654 | if ( name in thisCache ) { |
| 1655 | name = [ name ]; |
| 1656 | } else { |
| 1657 | name = name.split(" "); |
| 1658 | } |
| 1659 | } |
| 1660 | } else { |
| 1661 | // If "name" is an array of keys... |
| 1662 | // When data is initially created, via ("key", "val") signature, |
| 1663 | // keys will be converted to camelCase. |
| 1664 | // Since there is no way to tell _how_ a key was added, remove |
| 1665 | // both plain key and camelCase key. #12786 |
| 1666 | // This will only penalize the array argument path. |
| 1667 | name = name.concat( jQuery.map( name, jQuery.camelCase ) ); |
| 1668 | } |
| 1669 | |
| 1670 | for ( i = 0, l = name.length; i < l; i++ ) { |
| 1671 | delete thisCache[ name[i] ]; |
| 1672 | } |
| 1673 | |
| 1674 | // If there is no data left in the cache, we want to continue |
| 1675 | // and let the cache object itself get destroyed |
| 1676 | if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { |
no test coverage detected
searching dependent graphs…