Merge branch 'master' of github.com:jquery/jquery

This commit is contained in:
jeresig 2010-02-08 11:31:13 -05:00
commit fec02aa5cb
3 changed files with 4 additions and 4 deletions

View file

@ -624,7 +624,7 @@ jQuery.extend({
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( var prefix in a ) {
buildParams( traditional ? prefix : prefix.replace(/[\[\]]/g, ""), a[prefix] );
buildParams( prefix, a[prefix] );
}
}
@ -635,7 +635,7 @@ jQuery.extend({
if ( jQuery.isArray(obj) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional ) {
if ( traditional || /\[\]$/.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {

View file

@ -330,7 +330,7 @@ jQuery.extend({
}
// elem is actually elem.style ... set the style
// Using attr for specific style information is now deprecated. Use style insead.
// Using attr for specific style information is now deprecated. Use style instead.
return jQuery.style( elem, name, value );
}
});

View file

@ -379,7 +379,7 @@ test("jQuery.param()", function() {
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
equals( jQuery.param(params,true), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=undefined&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" );
equals( decodeURIComponent( jQuery.param({ "test[]": [0, 1, 2] }) ), "test[]=0&test[]=1&test[]=2", "Make sure params are double-encoded." );
equals( decodeURIComponent( jQuery.param({ a: [1,2,3], 'b[]': [4,5,6], 'c[d]': [7,8,9], e: { f: [10], g: [11,12], h: 13 } }) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." );
jQuery.ajaxSetup({ traditional: true });