Skip to main content

Bug Tracker

Side navigation

#12134 closed feature (fixed)

Opened July 24, 2012 09:56AM UTC

Closed November 25, 2012 07:55PM UTC

implement HTML5 compilant form data construction into $.fn.serialzeArray

Reported by: info@corrupt-system.de 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:

1. 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

2. Use the whitelist approach by the HTML spec

3. 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.

Attachments (0)
Change History (12)

Changed July 24, 2012 09:59AM UTC by info@corrupt-system.de comment:1

I copied the wrong URL for the gist, here ist the right url:

You find the gist here: https://gist.github.com/3169103

Changed July 24, 2012 08:06PM UTC by dmethvin comment:2

component: unfiledcore
keywords: → 1.9-discuss
priority: undecidedlow
status: newopen

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.

Changed September 09, 2012 01:10AM UTC by dmethvin comment:3

type: enhancementfeature

Bulk change from enhancement to feature.

Changed September 27, 2012 01:30PM UTC by gibson042 comment:4

+1

Changed October 14, 2012 10:35PM UTC by mikesherov comment:5

+1

Changed October 14, 2012 11:34PM UTC by rwaldron comment:6

+1, Definitely and thanks for the report

Changed October 22, 2012 05:19PM UTC by gibson042 comment:7

+1

Changed October 22, 2012 05:32PM UTC by gnarf comment:8

+1

Changed October 29, 2012 05:09PM UTC by mikesherov comment:9

milestone: None1.9
owner: → dmethvin
status: openassigned

Changed November 15, 2012 02:45AM UTC by dmethvin comment:10

@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.

Changed November 25, 2012 07:48PM UTC by dmethvin comment:11

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.

Changed November 25, 2012 07:55PM UTC by Dave Methvin comment:12

resolution: → fixed
status: assignedclosed

Fix #12134. Make .serialize() HTML5-compliant; provide a propHook for shimming.

Changeset: ae215fdcf843862dbddbdfd68117ac2926e35a42