diff options
author | Michał Gołębiowski <m.goleb@gmail.com> | 2015-09-07 23:22:56 +0200 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2015-09-08 00:33:09 +0200 |
commit | a9930565f157df4bcae63c108aeb9f4825c7314a (patch) | |
tree | 49b9f7e884a7ffd68fe38737d17b11918a2e07f4 | |
parent | f0b86ec050305ac1fbddd4943361b423d86feb4b (diff) | |
download | jquery-a9930565f157df4bcae63c108aeb9f4825c7314a.tar.gz jquery-a9930565f157df4bcae63c108aeb9f4825c7314a.zip |
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
-rw-r--r-- | src/serialize.js | 2 |
1 files changed, 1 insertions, 1 deletions
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 |