( prefix, obj, traditional, add )
| 13 | rsubmittable = /^(?:input|select|textarea|keygen)/i; |
| 14 | |
| 15 | function buildParams( prefix, obj, traditional, add ) { |
| 16 | var name; |
| 17 | |
| 18 | if ( Array.isArray( obj ) ) { |
| 19 | |
| 20 | // Serialize array item. |
| 21 | jQuery.each( obj, function( i, v ) { |
| 22 | if ( traditional || rbracket.test( prefix ) ) { |
| 23 | |
| 24 | // Treat each array item as a scalar. |
| 25 | add( prefix, v ); |
| 26 | |
| 27 | } else { |
| 28 | |
| 29 | // Item is non-scalar (array or object), encode its numeric index. |
| 30 | buildParams( |
| 31 | prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", |
| 32 | v, |
| 33 | traditional, |
| 34 | add |
| 35 | ); |
| 36 | } |
| 37 | } ); |
| 38 | |
| 39 | } else if ( !traditional && toType( obj ) === "object" ) { |
| 40 | |
| 41 | // Serialize object item. |
| 42 | for ( name in obj ) { |
| 43 | buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); |
| 44 | } |
| 45 | |
| 46 | } else { |
| 47 | |
| 48 | // Serialize scalar item. |
| 49 | add( prefix, obj ); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // Serialize an array of form elements or a set of |
| 54 | // key/values into a query string |
no test coverage detected