diff options
author | Joe Trumbull <trumbull.j@gmail.com> | 2016-03-17 10:06:11 -0400 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2016-04-05 10:38:56 -0400 |
commit | 9fdbdd393a0f0ebdcd837cf102878c8b45860c3b (patch) | |
tree | d6421e5d6aba3a3c4143a4e735bc6232a8f882a8 /src/serialize.js | |
parent | 5d20a3c3f10bda935c8370392a25e45719afa6b9 (diff) | |
download | jquery-9fdbdd393a0f0ebdcd837cf102878c8b45860c3b.tar.gz jquery-9fdbdd393a0f0ebdcd837cf102878c8b45860c3b.zip |
Serialize: Treat literal and function-returned null/undefined the same
Fixes gh-3005
Closes gh-3007
Diffstat (limited to 'src/serialize.js')
-rw-r--r-- | src/serialize.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/serialize.js b/src/serialize.js index a0b948460..9a735fec1 100644 --- a/src/serialize.js +++ b/src/serialize.js @@ -58,7 +58,10 @@ jQuery.param = function( a, traditional ) { add = function( key, value ) { // If value is a function, invoke it and return its value - value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); + value = jQuery.isFunction( value ) ? value() : value; + if ( value == null ) { + value = ""; + } s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; |