* Return the new value from `set(owner, key, value)`.
* Use `set(owner, key, value)` rather than `access(owner, key, value)`.
Close gh-5392
cache[ camelCase( prop ) ] = data[ prop ];
}
}
- return cache;
+ return value;
},
get: function( owner, key ) {
return key === undefined ?
hidden = dataShow.hidden;
}
} else {
- dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
+ dataShow = dataPriv.set( elem, "fxshow", { display: restoreDisplay } );
}
// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
}
function cloneCopyEvent( src, dest ) {
- var i, l, type, pdataOld, udataOld, udataCur, events;
+ var type, i, l,
+ events = dataPriv.get( src, "events" );
if ( dest.nodeType !== 1 ) {
return;
}
// 1. Copy private data: events, handlers, etc.
- if ( dataPriv.hasData( src ) ) {
- pdataOld = dataPriv.get( src );
- events = pdataOld.events;
-
- if ( events ) {
- dataPriv.remove( dest, "handle events" );
-
- for ( type in events ) {
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type, events[ type ][ i ] );
- }
+ if ( events ) {
+ dataPriv.remove( dest, "handle events" );
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// 2. Copy user data
if ( dataUser.hasData( src ) ) {
- udataOld = dataUser.access( src );
- udataCur = jQuery.extend( {}, udataOld );
-
- dataUser.set( dest, udataCur );
+ dataUser.set( dest, jQuery.extend( {}, dataUser.get( src ) ) );
}
}
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
- !dataPriv.access( node, "globalEval" ) &&
+ !dataPriv.get( node, "globalEval" ) &&
jQuery.contains( doc, node ) ) {
if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || Array.isArray( data ) ) {
- queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
+ queue = dataPriv.set( elem, type, jQuery.makeArray( data ) );
} else {
queue.push( data );
}
// Not public - generate a queueHooks object, or return the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
- return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
+ return dataPriv.get( elem, key ) || dataPriv.set( elem, key, {
empty: jQuery.Callbacks( "once memory" ).add( function() {
dataPriv.remove( elem, [ type + "queue", key ] );
} )