Skip to content

Commit

Permalink
Simplify jQuery.expando
Browse files Browse the repository at this point in the history
  • Loading branch information
markelog committed Dec 23, 2012
1 parent c334878 commit d552b94
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions src/manipulation.js
Expand Up @@ -502,7 +502,6 @@ jQuery.extend({
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;

for ( ; (elem = elems[ i ]) != null; i++ ) {
Expand All @@ -513,37 +512,20 @@ jQuery.extend({
data = id && cache[ id ];

if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );

// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}

// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {

delete cache[ id ];

// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( deleteExpando ) {
delete elem[ internalKey ];

} else if ( elem.removeAttribute ) {
elem.removeAttribute( internalKey );

} else {
elem[ internalKey ] = null;
}

core_deletedIds.push( id );
delete elem[ internalKey ];
}
}
}
Expand Down

0 comments on commit d552b94

Please sign in to comment.