The following form contains each of the possible elements that can be submitted (with the exception of <input type="file">
).
Which elements, and how they should be submitted, is specified here:
http://www.w3.org/TR/html401/interact/forms.html#h-17.13
Notes
This test page does not expose serialization problems that occur during an actual form submit. These include:- YUI, Prototype and MochiKit do not support input elements of
type="image"
. - dojo does not capture the click coordinates of input elements of
type="image"
. However, it does correctly recognize it as the submitting element. - dojo does not properly support semantic serialization when the form contains an input of
type="image"
. When such an element is used to submit the form, it will always appear last in the query string regardless of its semantic position. (This is likely a very low-percentage use case.) - mootools is not compatible with Prototype and is not included on this test page. A test page that includes mootools can be found here. In summary, mootools does not support semantic serialization and it incorrectly submits disabled fields.
Encoding
Each of the libraries tested use JavaScript'sencodeURIComponent
[2] function to encode form data.
Technically, this does not conform to the HTML spec which
states the following
about the application/x-www-form-urlencoded
content type (emphasis added):
This is the default content type. Forms submitted with this content type must be encoded as follows:While this does not seem to cause any problems, it is interesting and noteworthy.
- Control names and values are escaped. Space characters are replaced by `+', and then reserved characters are escaped as described in [RFC1738], section 2.2: Non-alphanumeric characters are replaced by `%HH', a percent sign and two hexadecimal digits representing the ASCII code of the character. Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A').
- The control names/values are listed in the order they appear in the document. The name is separated from the value by `=' and name/value pairs are separated from each other by '&'.