aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlouisremi <louisremi@louisremi-laptop.(none)>2011-04-12 11:29:25 +0200
committerlouisremi <louisremi@louisremi-laptop.(none)>2011-04-12 11:29:25 +0200
commita5604aedb74ec39624b21229a5c8542c793b0382 (patch)
tree9fa541ff92d96a8979af260a31f2d75492e696fd /src
parent8547b34f9265ed2d2b5380b1db5dfcaf97d96d5a (diff)
parent312df0441b16981dd697d74fcbc1e1f212b47b7e (diff)
downloadjquery-a5604aedb74ec39624b21229a5c8542c793b0382.tar.gz
jquery-a5604aedb74ec39624b21229a5c8542c793b0382.zip
merge with master and resolve more conflicts
Diffstat (limited to 'src')
-rw-r--r--src/attributes.js2
-rw-r--r--src/core.js7
-rw-r--r--src/css.js25
-rw-r--r--src/effects.js17
-rw-r--r--src/event.js26
-rw-r--r--src/offset.js8
-rw-r--r--src/queue.js95
-rw-r--r--src/support.js9
-rw-r--r--src/traversing.js11
9 files changed, 132 insertions, 68 deletions
diff --git a/src/attributes.js b/src/attributes.js
index c34cd6193..5ccbf2cde 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -479,7 +479,7 @@ jQuery.each([ "selected", "checked", "readOnly", "disabled" ], function( i, name
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height", "list" ], function( i, name ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
diff --git a/src/core.js b/src/core.js
index d3641365b..fa15cffc0 100644
--- a/src/core.js
+++ b/src/core.js
@@ -613,8 +613,11 @@ jQuery.extend({
}
}
} else {
- for ( var value = object[0];
- i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
+ for ( ; i < length; ) {
+ if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
+ break;
+ }
+ }
}
}
diff --git a/src/css.js b/src/css.js
index dfa820e22..964b18fcd 100644
--- a/src/css.js
+++ b/src/css.js
@@ -122,11 +122,17 @@ jQuery.extend({
},
css: function( elem, name, extra ) {
+ var ret, hooks;
+
// Make sure that we're working with the right name
- var ret, origName = jQuery.camelCase( name ),
- hooks = jQuery.cssHooks[ origName ];
+ name = jQuery.camelCase( name );
+ hooks = jQuery.cssHooks[ name ];
+ name = jQuery.cssProps[ name ] || name;
- name = jQuery.cssProps[ origName ] || origName;
+ // cssFloat needs a special treatment
+ if ( name === "cssFloat" ) {
+ name = "float";
+ }
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
@@ -134,7 +140,7 @@ jQuery.extend({
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
- return curCSS( elem, name, origName );
+ return curCSS( elem, name );
}
},
@@ -231,7 +237,8 @@ if ( !jQuery.support.opacity ) {
},
set: function( elem, value ) {
- var style = elem.style;
+ var style = elem.style,
+ currentStyle = elem.currentStyle;
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
@@ -241,11 +248,15 @@ if ( !jQuery.support.opacity ) {
var opacity = jQuery.isNaN(value) ?
"" :
"alpha(opacity=" + value * 100 + ")",
- filter = style.filter || "";
+ filter = currentStyle && currentStyle.filter || style.filter || "";
style.filter = ralpha.test(filter) ?
filter.replace(ralpha, opacity) :
+<<<<<<< HEAD
style.filter + " " + opacity;
+=======
+ filter + " " + opacity;
+>>>>>>> 312df0441b16981dd697d74fcbc1e1f212b47b7e
}
};
}
@@ -273,7 +284,7 @@ jQuery(function() {
});
if ( document.defaultView && document.defaultView.getComputedStyle ) {
- getComputedStyle = function( elem, newName, name ) {
+ getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle;
name = name.replace( rupper, "-$1" ).toLowerCase();
diff --git a/src/effects.js b/src/effects.js
index f334ac95b..7aec83009 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -121,13 +121,17 @@ jQuery.fn.extend({
var optall = jQuery.speed(speed, easing, callback);
if ( jQuery.isEmptyObject( prop ) ) {
- return this.each( optall.complete );
+ return this.each( optall.complete, [ false ] );
}
return this[ optall.queue === false ? "each" : "queue" ](function() {
// XXX 'this' does not always have a nodeName when running the
// test suite
+ if ( optall.queue === false ) {
+ jQuery._mark( this );
+ }
+
var opt = jQuery.extend({}, optall), p,
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
@@ -237,6 +241,10 @@ jQuery.fn.extend({
}
this.each(function() {
+ // clear marker counters if we know they won't be
+ if ( !gotoEnd ) {
+ jQuery._unmark( true, this );
+ }
// go in reverse order so anything added to the queue during the loop is ignored
for ( var i = timers.length - 1; i >= 0; i-- ) {
if ( timers[i].elem === this ) {
@@ -298,10 +306,13 @@ jQuery.extend({
// Queueing
opt.old = opt.complete;
- opt.complete = function() {
+ opt.complete = function( noUnmark ) {
if ( opt.queue !== false ) {
- jQuery(this).dequeue();
+ jQuery.dequeue( this );
+ } else if ( noUnmark !== false ) {
+ jQuery._unmark( this );
}
+
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
diff --git a/src/event.js b/src/event.js
index ac0da6b7e..7d5a1097b 100644
--- a/src/event.js
+++ b/src/event.js
@@ -24,17 +24,6 @@ jQuery.event = {
return;
}
- // TODO :: Use a try/catch until it's safe to pull this out (likely 1.6)
- // Minor release fix for bug #8018
- try {
- // For whatever reason, IE has trouble passing the window object
- // around, causing it to be cloned in the process
- if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
- elem = window;
- }
- }
- catch ( e ) {}
-
if ( handler === false ) {
handler = returnFalse;
} else if ( !handler ) {
@@ -304,7 +293,7 @@ jQuery.event = {
}
event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
-
+
// Handle a global trigger
if ( !elem ) {
// Don't bubble custom events when global (to avoid too much overhead)
@@ -574,6 +563,9 @@ jQuery.Event = function( src ) {
}
}
+ // Always ensure a type has been explicitly set
+ this.type = src.type;
+
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
@@ -1030,10 +1022,18 @@ jQuery.each(["live", "die"], function( i, name ) {
return this;
}
+ if ( name === "die" && !types &&
+ origSelector && origSelector[0] === "." ) {
+
+ context.unbind( origSelector );
+
+ return this;
+ }
+
if ( data === false || jQuery.isFunction( data ) ) {
fn = data || returnFalse;
data = undefined;
- }
+ }
types = (types || "").split(" ");
diff --git a/src/offset.js b/src/offset.js
index b9a132b42..95177434c 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -186,11 +186,13 @@ jQuery.offset = {
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
}
- curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
- curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
-
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
diff --git a/src/queue.js b/src/queue.js
index 701d06ade..ce2305426 100644
--- a/src/queue.js
+++ b/src/queue.js
@@ -1,27 +1,67 @@
(function( jQuery ) {
-jQuery.extend({
- queue: function( elem, type, data ) {
- if ( !elem ) {
- return;
- }
+function handleQueueMarkDefer( elem, type, src ) {
+ var deferDataKey = type + "defer",
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark",
+ defer = jQuery.data( elem, deferDataKey, undefined, true );
+ if ( defer &&
+ ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
+ ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
+ // Give room for hard-coded callbacks to fire first
+ // and eventually mark/queue something else on the element
+ setTimeout( function() {
+ if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
+ !jQuery.data( elem, markDataKey, undefined, true ) ) {
+ jQuery.removeData( elem, deferDataKey, true );
+ defer.resolve();
+ }
+ }, 0 );
+ }
+}
- type = (type || "fx") + "queue";
- var q = jQuery._data( elem, type );
+jQuery.extend({
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( !data ) {
- return q || [];
+ _mark: function( elem, type ) {
+ if ( elem ) {
+ type = (type || "fx") + "mark";
+ jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
}
+ },
- if ( !q || jQuery.isArray(data) ) {
- q = jQuery._data( elem, type, jQuery.makeArray(data) );
-
- } else {
- q.push( data );
+ _unmark: function( force, elem, type ) {
+ if ( force !== true ) {
+ type = elem;
+ elem = force;
+ force = false;
+ }
+ if ( elem ) {
+ type = type || "fx";
+ var key = type + "mark",
+ count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
+ if ( count ) {
+ jQuery.data( elem, key, count, true );
+ } else {
+ jQuery.removeData( elem, key, true );
+ handleQueueMarkDefer( elem, type, "mark" );
+ }
}
+ },
- return q;
+ queue: function( elem, type, data ) {
+ if ( elem ) {
+ type = (type || "fx") + "queue";
+ var q = jQuery.data( elem, type, undefined, true );
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !q || jQuery.isArray(data) ) {
+ q = jQuery.data( elem, type, jQuery.makeArray(data), true );
+ } else {
+ q.push( data );
+ }
+ }
+ return q || [];
+ }
},
dequeue: function( elem, type ) {
@@ -50,17 +90,7 @@ jQuery.extend({
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue", true );
- // Look if we have observers and resolve if needed
- if (( defer = jQuery.data( elem, type + "defer", undefined, true ) )) {
- // Give room for hard-coded callbacks to fire first
- // and eventually add another animation on the element
- setTimeout( function() {
- if ( !jQuery.data( elem, type + "queue", undefined, true ) ) {
- jQuery.removeData( elem, type + "defer", true );
- defer.resolve();
- }
- }, 0 );
- }
+ handleQueueMarkDefer( elem, type, "queue" );
}
}
});
@@ -75,7 +105,7 @@ jQuery.fn.extend({
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
- return this.each(function( i ) {
+ return this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
@@ -88,7 +118,6 @@ jQuery.fn.extend({
jQuery.dequeue( this, type );
});
},
-
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
@@ -102,11 +131,9 @@ jQuery.fn.extend({
}, time );
});
},
-
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, object ) {
@@ -120,7 +147,8 @@ jQuery.fn.extend({
i = elements.length,
count = 1,
deferDataKey = type + "defer",
- queueDataKey = type + "queue";
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark";
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
@@ -128,7 +156,8 @@ jQuery.fn.extend({
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
- jQuery.data( elements[ i ], queueDataKey, undefined, true ) &&
+ ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
+ jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
count++;
tmp.done( resolve );
diff --git a/src/support.js b/src/support.js
index 34960505a..6b19c0830 100644
--- a/src/support.js
+++ b/src/support.js
@@ -8,6 +8,7 @@ jQuery.support = (function() {
select,
opt,
input,
+ marginDiv,
support,
fragment,
body,
@@ -190,10 +191,12 @@ jQuery.support = (function() {
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( document.defaultView && document.defaultView.getComputedStyle ) {
- div.style.width = "1px";
- div.style.marginRight = "0";
+ marginDiv = document.createElement('div');
+ marginDiv.style.width = "0";
+ marginDiv.style.marginRight = "0";
+ div.appendChild( marginDiv );
support.reliableMarginRight =
- ( parseInt( document.defaultView.getComputedStyle(div).marginRight, 10 ) || 0 ) === 0;
+ ( parseInt( document.defaultView.getComputedStyle( marginDiv ).marginRight, 10 ) || 0 ) === 0;
}
// Remove the body element we added
diff --git a/src/traversing.js b/src/traversing.js
index fb5946bba..e0f40151d 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -73,9 +73,9 @@ jQuery.fn.extend({
},
is: function( selector ) {
- return !!selector && (typeof selector === "string" ?
+ return !!selector && ( typeof selector === "string" ?
jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0);
+ this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
@@ -298,13 +298,18 @@ jQuery.extend({
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
- } else if ( qualifier && qualifier.nodeType ) {
+ } else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return (elem === qualifier) === keep;
});