MCPcopy Create free account
hub / github.com/JsAaron/jQuery / buildParams

Function buildParams

2.0.3/2.0.3.js:6812–6838  ·  view source on GitHub ↗
( prefix, obj, traditional, add )

Source from the content-addressed store, hash-verified

6810 };
6811
6812 function buildParams( prefix, obj, traditional, add ) {
6813 var name;
6814
6815 if ( jQuery.isArray( obj ) ) {
6816 // Serialize array item.
6817 jQuery.each( obj, function( i, v ) {
6818 if ( traditional || rbracket.test( prefix ) ) {
6819 // Treat each array item as a scalar.
6820 add( prefix, v );
6821
6822 } else {
6823 // Item is non-scalar (array or object), encode its numeric index.
6824 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
6825 }
6826 });
6827
6828 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
6829 // Serialize object item.
6830 for ( name in obj ) {
6831 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
6832 }
6833
6834 } else {
6835 // Serialize scalar item.
6836 add( prefix, obj );
6837 }
6838 }
6839 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
6840 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
6841 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {

Callers 1

2.0.3.jsFile · 0.70

Calls 1

addFunction · 0.70

Tested by

no test coverage detected