summaryrefslogtreecommitdiffstatshomepage
path: root/src/wp-includes/js/jquery/jquery.serialize-object.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/wp-includes/js/jquery/jquery.serialize-object.js')
-rw-r--r--src/wp-includes/js/jquery/jquery.serialize-object.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/wp-includes/js/jquery/jquery.serialize-object.js b/src/wp-includes/js/jquery/jquery.serialize-object.js
new file mode 100644
index 0000000000..03b905bf5b
--- /dev/null
+++ b/src/wp-includes/js/jquery/jquery.serialize-object.js
@@ -0,0 +1,31 @@
+/*!
+ * jQuery serializeObject - v0.2 - 1/20/2010
+ * http://benalman.com/projects/jquery-misc-plugins/
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+
+// Whereas .serializeArray() serializes a form into an array, .serializeObject()
+// serializes a form into an (arguably more useful) object.
+
+(function($,undefined){
+ '$:nomunge'; // Used by YUI compressor.
+
+ $.fn.serializeObject = function(){
+ var obj = {};
+
+ $.each( this.serializeArray(), function(i,o){
+ var n = o.name,
+ v = o.value;
+
+ obj[n] = obj[n] === undefined ? v
+ : $.isArray( obj[n] ) ? obj[n].concat( v )
+ : [ obj[n], v ];
+ });
+
+ return obj;
+ };
+
+})(jQuery);