From e2052153fc080e6664ca4ee5484188e2707379f5 Mon Sep 17 00:00:00 2001 From: Sathvik Ponangi Date: Mon, 22 Apr 2013 16:42:03 +0530 Subject: [PATCH 1/2] Support for jQuery.noConflict --- jquery.serializeObject.js | 50 ++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/jquery.serializeObject.js b/jquery.serializeObject.js index 1c8dac3..31695ae 100644 --- a/jquery.serializeObject.js +++ b/jquery.serializeObject.js @@ -11,30 +11,32 @@ // If you require camel casing, you can either download version 1.0.4 or map // them yourself. // -$.fn.serializeObject = function () { - "use strict"; - - var result = {}; - var extend = function (i, element) { - var node = result[element.name]; - -// If node with same name exists already, need to convert it to an array as it -// is a multi-value field (i.e., checkboxes) - - if ('undefined' !== typeof node && node !== null) { - if ($.isArray(node)) { - node.push(element.value); +(function($){ + $.fn.serializeObject = function () { + "use strict"; + + var result = {}; + var extend = function (i, element) { + var node = result[element.name]; + + // If node with same name exists already, need to convert it to an array as it + // is a multi-value field (i.e., checkboxes) + + if ('undefined' !== typeof node && node !== null) { + if ($.isArray(node)) { + node.push(element.value); + } else { + result[element.name] = [node, element.value]; + } } else { - result[element.name] = [node, element.value]; + result[element.name] = element.value; } - } else { - result[element.name] = element.value; - } + }; + + // For each serialzable element, convert element names to camelCasing and + // extend each of them to a JSON object + + $.each(this.serializeArray(), extend); + return result; }; - -// For each serialzable element, convert element names to camelCasing and -// extend each of them to a JSON object - - $.each(this.serializeArray(), extend); - return result; -}; +})(jQuery)'' From 1e073e5beb665df7e23102d8f7d0c36dd4f9846c Mon Sep 17 00:00:00 2001 From: Sathvik Ponangi Date: Mon, 22 Apr 2013 17:21:23 +0530 Subject: [PATCH 2/2] Remove typo quotes --- jquery.serializeObject.js | 57 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/jquery.serializeObject.js b/jquery.serializeObject.js index 31695ae..6f4af39 100644 --- a/jquery.serializeObject.js +++ b/jquery.serializeObject.js @@ -11,32 +11,31 @@ // If you require camel casing, you can either download version 1.0.4 or map // them yourself. // -(function($){ - $.fn.serializeObject = function () { - "use strict"; - - var result = {}; - var extend = function (i, element) { - var node = result[element.name]; - - // If node with same name exists already, need to convert it to an array as it - // is a multi-value field (i.e., checkboxes) - - if ('undefined' !== typeof node && node !== null) { - if ($.isArray(node)) { - node.push(element.value); - } else { - result[element.name] = [node, element.value]; - } - } else { - result[element.name] = element.value; - } - }; - - // For each serialzable element, convert element names to camelCasing and - // extend each of them to a JSON object - - $.each(this.serializeArray(), extend); - return result; - }; -})(jQuery)'' +(function($) { + $.fn.serializeObject = function() {"use strict"; + + var result = {}; + var extend = function(i, element) { + var node = result[element.name]; + + // If node with same name exists already, need to convert it to an array as it + // is a multi-value field (i.e., checkboxes) + + if ('undefined' !== typeof node && node !== null) { + if ($.isArray(node)) { + node.push(element.value); + } else { + result[element.name] = [node, element.value]; + } + } else { + result[element.name] = element.value; + } + }; + + // For each serialzable element, convert element names to camelCasing and + // extend each of them to a JSON object + + $.each(this.serializeArray(), extend); + return result; + }; +})(jQuery);