Skip to content

Commit 14c0fe4

Browse files
committed
Serialize: Fix object detection
jQuery.type doesn't just return "null" for null but also e.g. "array" for arrays instead of object so it's not really a typeof analogue. My suggestion was stupid. Sorry. Refs 3d7ce0a
1 parent 3d7ce0a commit 14c0fe4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/serialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function buildParams( prefix, obj, traditional, add ) {
2828

2929
// Item is non-scalar (array or object), encode its numeric index.
3030
buildParams(
31-
prefix + "[" + ( jQuery.type( v ) === "object" ? i : "" ) + "]",
31+
prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
3232
v,
3333
traditional,
3434
add

0 commit comments

Comments
 (0)