Permalink
Browse files

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
  • Loading branch information...
mgol committed Sep 7, 2015
1 parent 3d7ce0a commit 14c0fe44328f22debb5b531d2b671923658542b3
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/serialize.js
View
@@ -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

0 comments on commit 14c0fe4

Please sign in to comment.