Opened 11 years ago
Closed 11 years ago
#12134 closed feature (fixed)
implement HTML5 compilant form data construction into $.fn.serialzeArray
Reported by: | Owned by: | dmethvin | |
---|---|---|---|
Priority: | low | Milestone: | 1.9 |
Component: | core | Version: | 1.7.2 |
Keywords: | 1.9-discuss | Cc: | |
Blocked by: | Blocking: |
Description
The way the data of a form is constructed differs a little bit from the way it is defined in the HTML5 spec. Currently the form data is build using a white list of input[types], while the spec uses a black list. (http://www.w3.org/TR/2011/WD-html5-20110525/association-of-controls-and-forms.html#constructing-form-data-set).
I have created a gist, which suggests 3 code changes:
- instead of using this.elements use jQuery.prop( this, "elements" ) to allow polyfills to use a propHook for "elements" and/or implement input[form] and fieldset.elements in a way, that is compilant to serializeArray
- Use the whitelist approach by the HTML spec
- Use jQuery.is( this, ":disabled" ) instead of this.disabled, because fieldset[disabled] input, won't affect the disabled property, but makes the input truly disabled.
Change History (12)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Component: | unfiled → core |
---|---|
Keywords: | 1.9-discuss added |
Priority: | undecided → low |
Status: | new → open |
The changes seem reasonable and align our handling with HTML5 so it seems like a good idea. Since we're just about ready for a 1.8 release I'll add this for the 1.9 pile.
comment:3 Changed 11 years ago by
Type: | enhancement → feature |
---|
Bulk change from enhancement to feature.
comment:9 Changed 11 years ago by
Milestone: | None → 1.9 |
---|---|
Owner: | set to dmethvin |
Status: | open → assigned |
comment:10 Changed 11 years ago by
@info, would you be able to create some test cases for this code? A pull request would be great as well but I can work from your gist if you prefer.
comment:11 Changed 11 years ago by
Unfortunately, oldIE doesn't have querySelectorAll
, and Sizzle doesn't currently consider children of a disabled fieldset to be disabled.
http://jsfiddle.net/dmethvin/65QUz/
I'll land this, but I can't yet create a test case that succeeds on oldIE so I'll open a ticket for the Sizzle issue.
comment:12 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fix #12134. Make .serialize() HTML5-compliant; provide a propHook for shimming.
Changeset: ae215fdcf843862dbddbdfd68117ac2926e35a42
I copied the wrong URL for the gist, here ist the right url: You find the gist here: https://gist.github.com/3169103