merge with master and resolve more conflicts

This commit is contained in:
louisremi 2011-04-12 11:29:25 +02:00
commit a5604aedb7
19 changed files with 322 additions and 87 deletions

View file

@ -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 );

View file

@ -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;
}
}
}
}

View file

@ -122,11 +122,17 @@ jQuery.extend({
},
css: function( elem, name, extra ) {
// Make sure that we're working with the right name
var ret, origName = jQuery.camelCase( name ),
hooks = jQuery.cssHooks[ origName ];
var ret, hooks;
name = jQuery.cssProps[ origName ] || origName;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// 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();

17
src/effects.js vendored
View file

@ -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 );
}

View file

@ -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(" ");

View file

@ -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 );
}

View file

@ -1,27 +1,67 @@
(function( jQuery ) {
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 );
}
}
jQuery.extend({
queue: function( elem, type, data ) {
if ( !elem ) {
return;
_mark: function( elem, type ) {
if ( elem ) {
type = (type || "fx") + "mark";
jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
}
},
type = (type || "fx") + "queue";
var q = jQuery._data( elem, type );
_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" );
}
}
},
// Speed up dequeue by getting out quickly if this is just a lookup
if ( !data ) {
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 || [];
}
if ( !q || jQuery.isArray(data) ) {
q = jQuery._data( elem, type, jQuery.makeArray(data) );
} 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 );

View file

@ -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

View file

@ -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;
});