Skip to content

Commit 784bc01

Browse files
committed
Serialize: use jquery type and clean up formatting
1 parent 9f4f7ba commit 784bc01

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/serialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function buildParams( prefix, obj, traditional, add ) {
2525
} else {
2626
// Item is non-scalar (array or object), encode its numeric index.
2727
buildParams(
28-
prefix + "[" + ( typeof v === "object" && v !== null ? i : "" ) + "]",
28+
prefix + "[" + ( jQuery.type( v ) === "object" ? i : "" ) + "]",
2929
v,
3030
traditional,
3131
add

test/unit/serialize.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ test("jQuery.param()", function() {
7777
params = {"test": {"length": 3, "foo": "bar"} };
7878
equal( jQuery.param( params, false ), "test%5Blength%5D=3&test%5Bfoo%5D=bar", "Sub-object with a length property" );
7979

80-
params = {"test": [1,2,null]};
81-
equal(jQuery.param(params, false), "test%5B%5D=1&test%5B%5D=2&test%5B%5D=", "object with array property with null value");
80+
params = { "test": [ 1, 2, null ] };
81+
equal( jQuery.param( params, false ), "test%5B%5D=1&test%5B%5D=2&test%5B%5D=", "object with array property with null value" );
8282

8383
if ( jQuery.ajaxSettings === settings ) {
8484
delete jQuery.ajaxSettings;

0 commit comments

Comments
 (0)