Skip to content
Permalink
Browse files

Merge branch 'master' into attrhooks.1.6v2

  • Loading branch information...
timmywil
timmywil committed Apr 10, 2011
2 parents da89d87 + 7fb95eb commit c10a76ec71b49575dad22b26c8675cfa8b41d862
Showing with 1,041 additions and 537 deletions.
  1. +83 −0 README.md
  2. +3 −3 src/ajax.js
  3. +1 −1 src/ajax/jsonp.js
  4. +3 −3 src/ajax/script.js
  5. +15 −1 src/attributes.js
  6. +42 −44 src/core.js
  7. +12 −3 src/css.js
  8. +8 −4 src/data.js
  9. +30 −3 src/deferred.js
  10. +15 −4 src/effects.js
  11. +124 −140 src/event.js
  12. +44 −1 src/queue.js
  13. +1 −1 src/sizzle
  14. +146 −155 src/support.js
  15. +3 −3 test/data/readywaitloader.js
  16. +10 −8 test/readywait.html
  17. +1 −1 test/unit/ajax.js
  18. +36 −2 test/unit/core.js
  19. +32 −0 test/unit/css.js
  20. +18 −1 test/unit/data.js
  21. +252 −126 test/unit/deferred.js
  22. +23 −18 test/unit/effects.js
  23. +139 −15 test/unit/event.js
@@ -56,6 +56,89 @@ Sometimes, the various git repositories get into an inconsistent state where bui
(usually this results in the jquery.js or jquery.min.js being 0 bytes). If this happens, run `make clean`, then
run `make` again.

Git for dummies
---------------

As the source code is handled by the version control system Git, it's useful to know some features used.

### Submodules ###

The repository uses submodules, which normally are handles 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:

1. `git clone https://github.com/jquery/jquery.git`
2. `git submodule init`
3. `git submodule update`

Or:

1. `git clone https://github.com/jquery/jquery.git`
2. `git submodule update --init`

Or:

1. `git clone --recursive https://github.com/jquery/jquery.git`

If you want to work inside a submodule, it is possible, but first you need to checkout a branch:

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,
but remember to push the submodule changes before pushing the new jquery commit:

1. `cd src/sizzle`
2. `git push origin master`
3. `cd ..`
4. `git add src/sizzle`
5. `git commit`

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
when you are doing a normal `make`.

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

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

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

make a `make pull_submodules` and after that a `git pull`. if you have no remote tracking in your master branch, you can
execute this command as `make pull REMOTE=origin BRANCH=master` instead.

### cleaning ###

If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):

1. `git reset --hard upstream/master`
2. `git clean -fdx`

### rebasing ###

For feature/topic branches, you should always used the `--rebase` flag to `git pull`, or if you are usually handling many temporary "to be in a github pull request" branches, run following to automate this:

* `git config branch.autosetuprebase local` (see `man git-config` for more information)

### handling merge conflicts ###

If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature
`git mergetool`. Even though the default tool `xxdiff` looks awful/old, it's rather useful.

Following are some commands that can be used there:

* `Ctrl + Alt + M` - automerge as much as possible
* `b` - jump to next merge conflict
* `s` - change the order of the conflicted lines
* `u` - undo an merge
* `left mouse button` - mark a block to be the winner
* `middle mouse button` - mark a line to be the winner
* `Ctrl + S` - save
* `Ctrl + Q` - quit

Questions?
----------
@@ -248,7 +248,7 @@ jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".sp
jQuery.fn[ o ] = function( f ){
return this.bind( o, f );
};
} );
});

jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
@@ -267,7 +267,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
dataType: type
});
};
} );
});

jQuery.extend({

@@ -757,7 +757,7 @@ jQuery.extend({
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
} );
});

} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
@@ -76,6 +76,6 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
// Delegate to script
return "script";
}
} );
});

})( jQuery );
@@ -25,7 +25,7 @@ jQuery.ajaxPrefilter( "script", function( s ) {
s.type = "GET";
s.global = false;
}
} );
});

// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
@@ -53,7 +53,7 @@ jQuery.ajaxTransport( "script", function(s) {
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {

if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {

// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
@@ -84,6 +84,6 @@ jQuery.ajaxTransport( "script", function(s) {
}
};
}
} );
});

})( jQuery );
@@ -24,6 +24,20 @@ jQuery.fn.extend({
return jQuery.access( this, name, value, true, jQuery.prop );
},

removeProp: function( name ) {
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},

prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop );
},

removeProp: function( name ) {
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
@@ -514,4 +528,4 @@ if ( !jQuery.support.optSelected ) {
});
}

})( jQuery );
})( jQuery );
@@ -17,7 +17,7 @@ var jQuery = function( selector, context ) {

// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,

// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
@@ -96,7 +96,12 @@ jQuery.fn = jQuery.prototype = {
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
match = quickExpr.exec( selector );
if ( selector.length > 1024 ) {
// Assume very large strings are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = quickExpr.exec( selector );
}

// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
@@ -369,15 +374,19 @@ jQuery.extend({
// the ready event fires. See #6781
readyWait: 1,

// Handle when the DOM is ready
ready: function( wait ) {
// A third-party is pushing the ready event forwards
if ( wait === true ) {
jQuery.readyWait--;
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},

// Make sure that the DOM is not already loaded
if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
// Handle when the DOM is ready
ready: function( wait ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
@@ -515,20 +524,21 @@ jQuery.extend({
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );

// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}

// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test(data.replace(rvalidescape, "@")
.replace(rvalidtokens, "]")
.replace(rvalidbraces, "")) ) {
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {

// Try to use the native JSON parser first
return window.JSON && window.JSON.parse ?
window.JSON.parse( data ) :
(new Function("return " + data))();
return (new Function( "return " + data ))();

} else {
jQuery.error( "Invalid JSON: " + data );
}
jQuery.error( "Invalid JSON: " + data );
},

// Cross-browser xml parsing
@@ -555,24 +565,17 @@ jQuery.extend({

noop: function() {},

// Evalulates a script in a global context
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && rnotwhite.test(data) ) {
// Inspired by code by Andrea Giammarchi
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
script = document.createElement( "script" );

if ( jQuery.support.scriptEval() ) {
script.appendChild( document.createTextNode( data ) );
} else {
script.text = data;
}

// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709).
head.insertBefore( script, head.firstChild );
head.removeChild( script );
if ( data && rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},

@@ -655,8 +658,9 @@ jQuery.extend({
},

inArray: function( elem, array ) {
if ( array.indexOf ) {
return array.indexOf( elem );

if ( indexOf ) {
return indexOf.call( array, elem );
}

for ( var i = 0, length = array.length; i < length; i++ ) {
@@ -840,12 +844,6 @@ if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}

if ( indexOf ) {
jQuery.inArray = function( elem, array ) {
return indexOf.call( array, elem );
};
}

// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
@@ -894,4 +892,4 @@ function doScrollCheck() {
// Expose jQuery to the global object
return jQuery;

})();
})();
@@ -7,6 +7,8 @@ var ralpha = /alpha\([^)]*\)/i,
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
rrelNum = /^[+\-]=/,
rrelNumFilter = /[^+\-\.\de]+/g,

cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
@@ -75,20 +77,27 @@ jQuery.extend({
}

// Make sure that we're working with the right name
var ret, origName = jQuery.camelCase( name ),
var ret, type, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];

name = jQuery.cssProps[ origName ] || origName;

// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;

// Make sure that NaN and null values aren't set. See: #7116
if ( typeof value === "number" && isNaN( value ) || value == null ) {
if ( type === "number" && isNaN( value ) || value == null ) {
return;
}

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

// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}

0 comments on commit c10a76e

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