/wp-includes/js/jquery/jquery.serialize-object.js
https://bitbucket.org/skyarch-iijima/wordpress · JavaScript · 31 lines · 14 code · 7 blank · 10 comment · 0 complexity · d15c29a18d9ffa8b9b4ae86c3c0cfa22 MD5 · raw file
- /*!
- * 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);