lib/abaaso.js
function ( obj, string, encode ) {
		string       = ( string === true );
		encode       = ( encode !== false );
		var children = [],
		    registry = {},
		    result;

		children = obj.nodeName === "FORM" ? ( obj.elements !== undefined ? array.cast( obj.elements ) : obj.find( "button, input, select, textarea" ) ) : [obj];

		array.each( children, function ( i ) {
			if ( i.nodeName === "FORM" ) {
				utility.merge( registry, json.decode( element.serialize( i ) ) );
			}
			else if ( registry[i.name] === undefined ) {
				registry[i.name] = element.val( i );
			}
		});

		if ( !string ) {
			result = json.encode( registry );
		}
		else {
			result = "";

			utility.iterate( registry, function ( v, k ) {
				encode ? result += "&" + encodeURIComponent( k ) + "=" + encodeURIComponent( v ) : result += "&" + k + "=" + v;
			});

			result = result.replace( regex.and, "?" );
		}

		return result;
	}
function ( obj, string, encode ) {
		string       = ( string === true );
		encode       = ( encode !== false );
		var children = [],
		    registry = {},
		    result;

		children = obj.nodeName === "FORM" ? ( obj.elements !== undefined ? array.cast( obj.elements ) : obj.find( "button, input, select, textarea" ) ) : [obj];

		array.each( children, function ( i ) {
			if ( i.nodeName === "FORM" ) {
				utility.merge( registry, json.decode( element.serialize( i ) ) );
			}
			else if ( registry[i.name] === undefined ) {
				registry[i.name] = element.val( i );
			}
		});

		if ( !string ) {
			result = json.encode( registry );
		}
		else {
			result = "";

			utility.iterate( registry, function ( v, k ) {
				encode ? result += "&" + encodeURIComponent( k ) + "=" + encodeURIComponent( v ) : result += "&" + k + "=" + v;
			});

			result = result.replace( regex.and, "?" );
		}

		return result;
	}
function ( obj , string , encode ) { string = ( string === true ) ; encode = ( encode !== false ) ; var children = [ ] , registry = { } , result ; children = obj . nodeName === "FORM" ? ( obj . elements !== undefined ? array . cast ( obj . elements ) : obj . find ( "button, input, select, textarea" ) ) : [ obj ] ; array . each ( children , function ( i ) { if ( i . nodeName === "FORM" ) { utility . merge ( registry , json . decode ( element . serialize ( i ) ) ) ; } else if ( registry [ i . name ] === undefined ) { registry [ i . name ] = element . val ( i ) ; } } ) ; if ( ! string ) { result = json . encode ( registry ) ; } else { result = "" ; utility . iterate ( registry , function ( v , k ) { encode ? result += "&" + encodeURIComponent ( k ) + "=" + encodeURIComponent ( v ) : result += "&" + k + "=" + v ; } ) ; result = result . replace ( regex . and , "?" ) ; } return result ; }
Serializes the elements of an Element

@method serialize
@param  {Object}  obj    Element
@param  {Boolean} string [Optional] true if you want a query string, default is false ( JSON )
@param  {Boolean} encode [Optional] true if you want to URI encode the value, default is true
@return {Mixed}          String or Object
Serializes the elements of an Element