From 9fdbdd393a0f0ebdcd837cf102878c8b45860c3b Mon Sep 17 00:00:00 2001 From: Joe Trumbull Date: Thu, 17 Mar 2016 10:06:11 -0400 Subject: Serialize: Treat literal and function-returned null/undefined the same Fixes gh-3005 Closes gh-3007 --- src/serialize.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/serialize.js') 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 ); }; -- cgit v1.2.3