Skip to content

serializeArray: Document Behavior for Value-less Input Elements#1018

Closed
jugglinmike wants to merge 1 commit into
jquery:masterfrom
jugglinmike:serialize-no-value
Closed

serializeArray: Document Behavior for Value-less Input Elements#1018
jugglinmike wants to merge 1 commit into
jquery:masterfrom
jugglinmike:serialize-no-value

Conversation

@jugglinmike
Copy link
Copy Markdown
Contributor

Formally define jQuery's behavior when <input> elements which specify a
name property but no corresponding value. This behavior should be considered
stable because it is implicitly asserted in jQuery's unit test suite through
tests for the serialize method [1].

[1] https://github.com/jquery/jquery/blob/efdb8a46e4213dcf69f792c42c234c6b112ba471/test/unit/serialize.js#L125-L127

The expected behavior here is a little ambiguous because it could also be valid to simply skip such elements in the serialization process. That is the Cheerio project's current behavior, but before altering it to match jQuery's current behavior, I'd like to make the behavior explicit.

Formally define jQuery's behavior when `<input>` elements which specify a
`name` property but no corresponding `value`. This behavior should be considered
stable because it is implicitly asserted in jQuery's unit test suite through
tests for the `serialize` method [1].

[1] https://github.com/jquery/jquery/blob/efdb8a46e4213dcf69f792c42c234c6b112ba471/test/unit/serialize.js#L125-L127
@jsf-clabot
Copy link
Copy Markdown

jsf-clabot commented Jan 15, 2017

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@dmethvin dmethvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even reading the spec that's already referenced in the paragraph, I can see how this could be ambiguous because of the roundabout way the spec talks about current value. The value attribute can be undefined but the value property is always present and defaults to an empty string if there's no value attribute.

@jugglinmike
Copy link
Copy Markdown
Contributor Author

Thanks, Dave! Is there anything more I can do to get this patch landed?

@kswedberg kswedberg closed this in 79a5c0c Jan 22, 2017
@jugglinmike
Copy link
Copy Markdown
Contributor Author

Thanks, Karl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants