Skip to content
Permalink
Browse files

Merge branch 'master' of http://github.com/jquery/jquery into effects…

…Cleanup
  • Loading branch information...
louisremi
louisremi committed Apr 14, 2011
2 parents 780b798 + 38d6d9f commit 8806435a77886dad8970e8f9ddba1ef728d779f8
Showing with 1,556 additions and 1,284 deletions.
  1. +1 −1 Makefile
  2. +4 −4 README.md
  3. +14 −16 src/ajax/jsonp.js
  4. +1 −1 src/attributes.js
  5. +27 −22 src/core.js
  6. +21 −14 src/css.js
  7. +14 −3 src/effects.js
  8. +58 −45 src/event.js
  9. +15 −3 src/manipulation.js
  10. +28 −24 src/offset.js
  11. +62 −33 src/queue.js
  12. +1 −1 src/sizzle
  13. +7 −7 src/support.js
  14. +8 −3 src/traversing.js
  15. +4 −1 test/data/testsuite.css
  16. +127 −127 test/unit/ajax.js
  17. +191 −189 test/unit/attributes.js
  18. +77 −70 test/unit/core.js
  19. +77 −60 test/unit/css.js
  20. +23 −23 test/unit/data.js
  21. +6 −6 test/unit/dimensions.js
  22. +49 −49 test/unit/effects.js
  23. +118 −92 test/unit/event.js
  24. +247 −241 test/unit/manipulation.js
  25. +143 −109 test/unit/offset.js
  26. +117 −16 test/unit/queue.js
  27. +116 −124 test/unit/traversing.js
@@ -111,7 +111,7 @@ update_submodules:

# update the submodules to the latest at the most logical branch
pull_submodules:
@@git submodule foreach "git pull origin \$$(git branch --no-color --contains \$$(git rev-parse HEAD) | grep -v \( | head -1)"
@@git submodule foreach "git pull \$$(git config remote.origin.url)"
@@git submodule summary

pull: pull_submodules
@@ -63,7 +63,7 @@ As the source code is handled by the version control system Git, it's useful to

### Submodules ###

The repository uses submodules, which normally are handles directly by the Makefile, but sometimes you want to
The repository uses submodules, which normally are handled directly by the Makefile, but sometimes you want to
be able to work with them manually.

Following are the steps to manually get the submodules:
@@ -86,7 +86,7 @@ If you want to work inside a submodule, it is possible, but first you need to ch
1. `cd src/sizzle`
2. `git checkout master`

After you've commited your changes to the submodule, you'll update the jquery project to point to the new commit,
After you've committed your changes to the submodule, you'll update the jquery project to point to the new commit,
but remember to push the submodule changes before pushing the new jquery commit:

1. `cd src/sizzle`
@@ -99,12 +99,12 @@ The makefile has some targets to simplify submodule handling:

#### `make update_submodules` ####

checks out the commit pointed to byu jquery, but merges your local changes, if any. This target is executed
checks out the commit pointed to by jquery, but merges your local changes, if any. This target is executed
when you are doing a normal `make`.

#### `make pull_submodules` ####

updates the content of the submoduels to what is probably the latest upstream code
updates the content of the submodules to what is probably the latest upstream code.

#### `make pull` ####

@@ -14,34 +14,25 @@ jQuery.ajaxSetup({
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {

var dataIsString = ( typeof s.data === "string" );
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
( typeof s.data === "string" );

if ( s.dataTypes[ 0 ] === "jsonp" ||
originalSettings.jsonpCallback ||
originalSettings.jsonp != null ||
s.jsonp !== false && ( jsre.test( s.url ) ||
dataIsString && jsre.test( s.data ) ) ) {
inspectData && jsre.test( s.data ) ) ) {

var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2",
cleanUp = function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
};
replace = "$1" + jsonpCallback + "$2";

if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( dataIsString ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
@@ -59,8 +50,15 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
responseContainer = [ response ];
};

// Install cleanUp function
jqXHR.then( cleanUp, cleanUp );
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});

// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
@@ -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 );
@@ -358,9 +358,11 @@ jQuery.extend = jQuery.fn.extend = function() {

jQuery.extend({
noConflict: function( deep ) {
window.$ = _$;
if ( window.$ === jQuery ) {
window.$ = _$;
}

if ( deep ) {
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}

@@ -436,7 +438,7 @@ jQuery.extend({
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent("onreadystatechange", DOMContentLoaded);
document.attachEvent( "onreadystatechange", DOMContentLoaded );

// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
@@ -587,7 +589,7 @@ jQuery.extend({
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction(object);
isObj = length === undefined || jQuery.isFunction( object );

if ( args ) {
if ( isObj ) {
@@ -613,8 +615,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;
}
}
}
}

@@ -645,7 +650,7 @@ jQuery.extend({
// The extra typeof function check is to prevent crashes
// in Safari 2 (See: #3039)
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type(array);
var type = jQuery.type( array );

if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
@@ -841,24 +846,24 @@ jQuery.extend({
},

sub: function() {
function jQuerySubclass( selector, context ) {
return new jQuerySubclass.fn.init( selector, context );
}
jQuery.extend( true, jQuerySubclass, this );
jQuerySubclass.superclass = this;
jQuerySubclass.fn = jQuerySubclass.prototype = this();
jQuerySubclass.fn.constructor = jQuerySubclass;
jQuerySubclass.subclass = this.subclass;
jQuerySubclass.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
context = jQuerySubclass(context);
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}

return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
var rootjQuerySubclass = jQuerySubclass(document);
return jQuerySubclass;
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
},

browser: {}
@@ -93,7 +93,7 @@ jQuery.extend({

// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && rrelNum.test( value ) ) {
value = +value.replace( rrelNumFilter, '' ) + parseFloat( jQuery.css( elem, name ) );
value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
}

// If a number was passed in, add 'px' to the (except for certain CSS properties)
@@ -122,19 +122,25 @@ 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 ) {
return ret;

// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name, origName );
return curCSS( elem, name );
}
},

@@ -225,27 +231,28 @@ if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
(parseFloat(RegExp.$1) / 100) + "" :
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},

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
style.zoom = 1;

// Set the alpha filter to set the opacity
var opacity = jQuery.isNaN(value) ?
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) :
style.filter + ' ' + opacity;
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
@@ -273,7 +280,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();
@@ -152,13 +152,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"),
@@ -268,6 +272,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 ) {
@@ -319,10 +327,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 );
}

0 comments on commit 8806435

Please sign in to comment.
You can’t perform that action at this time.