madrobby/zepto — pull request #749 by levic (2013-04-29 04:39:55+00:00)
Title: Include array indexes in $.param()

#208 rewrote support for key[] support inside $.param(), but it doesn't work if you have objects inside arrays:

Consider the case of:

var[][a]=1&var[][b]=2&var[][c]=3

It is ambiguous whether the var[][b] belongs to the [a] object, the [c] object or is an object on its own. PHP at least treats it as a totally new object which means it is impossible to have an array with objects with multiple values. jQuery gets around this by always including the array index, so the above example would become (assuming the [b] belonged to the same object as the [a]):

var[0][a]=1&var[0][b]=2&var[1][c]=3

Demonstration fiddles:
http://jsfiddle.net/DQD3c/1/ (jquery)
http://jsfiddle.net/DQD3c/2/ (zepto)

Attached patch adds the array index back in & updates test cases. traditional argument passing doesn't change, as mentioned in #208 it can't handle nested items anyway.