#12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}

i = name.length;
while ( i-- ) {
delete thisCache[ name[i] ];
}

// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
return;
}
}
}

// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;

// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}

// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );

// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];

// When all else fails, null
} else {
cache[ id ] = null;
}
}

jQuery.extend({
cache: {},

// The following elements (space-suffixed to avoid Object.prototype collisions)
// throw uncatchable exceptions if you attempt to set expando properties
noData: {
"applet ": true,
"embed ": true,
// ...but Flash objects (which have this classid) *can* handle expandos
"object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
},

hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},

data: function( elem, name, data ) {
return internalData( elem, name, data );
},

removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},

// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},

_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
}
});

jQuery.fn.extend({
data: function( key, value ) {
var i, name, data,
elem = this[0],
attrs = elem && elem.attributes;

// Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves

// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );

if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
i = attrs.length;
while ( i-- ) {

// Support: IE11+
// The attrs elements can be null (#14894)
if ( attrs[ i ] ) {
name = attrs[ i ].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.slice(5) );
dataAttr( elem, name, data[ name ] );
}
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}

return data;
}

// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}

return arguments.length > 1 ?

// Sets one value
this.each(function() {
jQuery.data( this, key, value );
}) :

// Gets one value
// Try to fetch any internally stored data first
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
},

removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});


jQuery.extend({
queue: function( elem, type, data ) {
var queue;

if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );

// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},

dequeue: function( elem, type ) {
type = type || "fx";

var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};

// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}

if ( fn ) {

// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}

// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}

if ( !startLength && hooks ) {
hooks.empty.fire();
}
},

// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
})
});
}
});

jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;

if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}

if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}

return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );

// ensure a hooks for this queue
jQuery._queueHooks( this, type );

if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};

if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";

while ( i-- ) {

Prev | Next
Pg.: 1 ... 13 14 15 16 17 18 19 20 21 22 23 ... 47


Back to home | File page

Subscribe | Register | Login | N