| 78 | }; |
| 79 | |
| 80 | function buildParams(prefix, obj, traditional, add) { |
| 81 | var name; |
| 82 | |
| 83 | if (jQuery.isArray(obj)) { |
| 84 | // Serialize array item. |
| 85 | jQuery.each(obj, function(i, v) { |
| 86 | if (traditional || rbracket.test(prefix)) { |
| 87 | // Treat each array item as a scalar. |
| 88 | add(prefix, v); |
| 89 | |
| 90 | } else { |
| 91 | // Item is non-scalar (array or object), encode its numeric index. |
| 92 | buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add); |
| 93 | } |
| 94 | }); |
| 95 | |
| 96 | } else if (!traditional && jQuery.type(obj) === "object") { |
| 97 | // Serialize object item. |
| 98 | for (name in obj) { |
| 99 | buildParams(prefix + "[" + name + "]", obj[name], traditional, add); |
| 100 | } |
| 101 | |
| 102 | } else { |
| 103 | // Serialize scalar item. |
| 104 | add(prefix, obj); |
| 105 | } |
| 106 | } |
| 107 | jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " + |
| 108 | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
| 109 | "change select submit keydown keypress keyup error contextmenu").split(" "), function(i, name) { |