aboutsummaryrefslogtreecommitdiffstats
path: root/src/queue.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2009-12-21 19:58:13 -0500
committerjeresig <jeresig@gmail.com>2009-12-21 19:58:13 -0500
commit61e37d41490aed319a176c6ca7feb95e5505059c (patch)
tree62b7c9bbb5cba5f15c2a134a51dac84b35e0d0ce /src/queue.js
parent36c99dc0c7a745a88488f519b38de811d6d4c8d9 (diff)
downloadjquery-61e37d41490aed319a176c6ca7feb95e5505059c.tar.gz
jquery-61e37d41490aed319a176c6ca7feb95e5505059c.zip
Made a number of spacing changes to bring the code more-inline with the jQuery Core Style Guideline.
Diffstat (limited to 'src/queue.js')
-rw-r--r--src/queue.js34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/queue.js b/src/queue.js
index 3770f4d90..e52f37b85 100644
--- a/src/queue.js
+++ b/src/queue.js
@@ -1,41 +1,53 @@
jQuery.extend({
queue: function( elem, type, data ) {
- if ( !elem ) { return; }
+ if ( !elem ) {
+ return;
+ }
type = (type || "fx") + "queue";
var q = jQuery.data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
- if ( !data ) { return q || []; }
+ if ( !data ) {
+ return q || [];
+ }
if ( !q || jQuery.isArray(data) ) {
q = jQuery.data( elem, type, jQuery.makeArray(data) );
+
} else {
q.push( data );
}
+
return q;
},
- dequeue: function( elem, type ){
+ dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ), fn = queue.shift();
// If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) { fn = queue.shift(); }
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ }
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
- if ( type === "fx" ) { queue.unshift("inprogress"); }
+ if ( type === "fx" ) {
+ queue.unshift("inprogress");
+ }
- fn.call(elem, function() { jQuery.dequeue(elem, type); });
+ fn.call(elem, function() {
+ jQuery.dequeue(elem, type);
+ });
}
}
});
jQuery.fn.extend({
- queue: function(type, data){
+ queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
@@ -44,7 +56,7 @@ jQuery.fn.extend({
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
- return this.each(function(i, elem){
+ return this.each(function( i, elem ) {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
@@ -52,8 +64,8 @@ jQuery.fn.extend({
}
});
},
- dequeue: function(type){
- return this.each(function(){
+ dequeue: function( type ) {
+ return this.each(function() {
jQuery.dequeue( this, type );
});
},
@@ -72,7 +84,7 @@ jQuery.fn.extend({
});
},
- clearQueue: function(type){
+ clearQueue: function( type ) {
return this.queue( type || "fx", [] );
}
});