From a9930565f157df4bcae63c108aeb9f4825c7314a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82=C4=99biowski?= Date: Mon, 7 Sep 2015 23:22:56 +0200 Subject: [PATCH] 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. (cherry-picked from 14c0fe44328f22debb5b531d2b671923658542b3) Refs 3d7ce0a65f0707ff01a851822e57ba80adcff075 --- src/serialize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serialize.js b/src/serialize.js index 580bd7d00..ce96a90d6 100644 --- a/src/serialize.js +++ b/src/serialize.js @@ -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 -- 2.39.5