Skip to content

Commit

Permalink
Serialize: Fix object detection
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mgol committed Sep 7, 2015
1 parent 3d7ce0a commit 14c0fe4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/serialize.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function buildParams( prefix, obj, traditional, add ) {


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

0 comments on commit 14c0fe4

Please sign in to comment.