1 var expando = "jQuery" + now(), uuid = 0, windowData = {};
\r
6 data: function( elem, name, data ) {
\r
7 elem = elem == window ?
\r
11 var id = elem[ expando ];
\r
13 // Compute a unique ID for the element
\r
15 id = elem[ expando ] = ++uuid;
\r
17 // Only generate the data cache if we're
\r
18 // trying to access or manipulate it
\r
19 if ( name && !jQuery.cache[ id ] )
\r
20 jQuery.cache[ id ] = {};
\r
22 // Prevent overriding the named cache with undefined values
\r
23 if ( data !== undefined )
\r
24 jQuery.cache[ id ][ name ] = data;
\r
26 // Return the named cache data, or the ID for the element
\r
28 jQuery.cache[ id ][ name ] :
\r
32 removeData: function( elem, name ) {
\r
33 elem = elem == window ?
\r
37 var id = elem[ expando ];
\r
39 // If we want to remove a specific section of the element's data
\r
41 if ( jQuery.cache[ id ] ) {
\r
42 // Remove the section of cache data
\r
43 delete jQuery.cache[ id ][ name ];
\r
45 // If we've removed all the data, remove the element's cache
\r
48 for ( name in jQuery.cache[ id ] )
\r
52 jQuery.removeData( elem );
\r
55 // Otherwise, we want to remove all of the element's data
\r
57 // Clean up the element expando
\r
59 delete elem[ expando ];
\r
61 // IE has trouble directly removing the expando
\r
62 // but it's ok with using removeAttribute
\r
63 if ( elem.removeAttribute )
\r
64 elem.removeAttribute( expando );
\r
67 // Completely remove the data cache
\r
68 delete jQuery.cache[ id ];
\r
71 queue: function( elem, type, data ) {
\r
74 type = (type || "fx") + "queue";
\r
76 var q = jQuery.data( elem, type );
\r
78 if ( !q || jQuery.isArray(data) )
\r
79 q = jQuery.data( elem, type, jQuery.makeArray(data) );
\r
87 dequeue: function( elem, type ){
\r
88 var queue = jQuery.queue( elem, type ),
\r
91 if( !type || type === "fx" )
\r
94 if( fn !== undefined )
\r
100 data: function( key, value ){
\r
101 var parts = key.split(".");
\r
102 parts[1] = parts[1] ? "." + parts[1] : "";
\r
104 if ( value === undefined ) {
\r
105 var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
\r
107 if ( data === undefined && this.length )
\r
108 data = jQuery.data( this[0], key );
\r
110 return data === undefined && parts[1] ?
\r
111 this.data( parts[0] ) :
\r
114 return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
\r
115 jQuery.data( this, key, value );
\r
119 removeData: function( key ){
\r
120 return this.each(function(){
\r
121 jQuery.removeData( this, key );
\r
124 queue: function(type, data){
\r
125 if ( typeof type !== "string" ) {
\r
130 if ( data === undefined )
\r
131 return jQuery.queue( this[0], type );
\r
133 return this.each(function(){
\r
134 var queue = jQuery.queue( this, type, data );
\r
136 if( type == "fx" && queue.length == 1 )
\r
137 queue[0].call(this);
\r
140 dequeue: function(type){
\r
141 return this.each(function(){
\r
142 jQuery.dequeue( this, type );
\r