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.

(cherry-picked from 14c0fe4)

Refs 3d7ce0a
  • Loading branch information
mgol committed Sep 7, 2015
1 parent f0b86ec commit a993056
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/serialize.js
Original file line number 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.
buildParams(
prefix + "[" + ( jQuery.type( v ) === "object" ? i : "" ) + "]",
prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
v,
traditional,
add
Expand Down

0 comments on commit a993056

Please sign in to comment.