Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct bug in implementation of Cheerio#val #544

Merged
merged 1 commit into from
Dec 25, 2014

Conversation

jugglinmike
Copy link
Member

jQuery does not attempt to calculate the value of a radio input group.
Instead, when the value of such an element is queries, that element's
value attribute is returned directly.

Although slightly less convenient in some cases, this allows for direct
manipulation of radio input element values (which is otherwise
impossible).

jQuery does not attempt to calculate the value of a `radio` input group.
Instead, when the value of such an element is queries, that element's
`value` attribute is returned directly.

Although slightly less convenient in some cases, this allows for direct
manipulation of `radio` input element values (which is otherwise
impossible).
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) when pulling 23c2e3a on jugglinmike:fix-val into 5fce462 on cheeriojs:master.

@fb55
Copy link
Member

fb55 commented Jul 28, 2014

How differs the current behavior to jQuery in a browser? What problem do you want to solve?

@jugglinmike
Copy link
Member Author

Currently, Cheerio attempts to find the group that the selected radio input belongs to, and it returns/sets the value of the group. jQuery's implementation of val manipulates the value attribute of selected radio inputs directly. Here's an example: http://codepen.io/anon/pen/Buvja

The problem I want to solve is parity with jQuery. jQuery's implementation is more useful because it allows you to get/set the value of elements that are not currently "checked" (this is impossible with Cheerio today).

@jugglinmike
Copy link
Member Author

@fb55 Triaging some old issues, I found that the current behavior was reported as a bug at the beginning of this year: gh-370. Does that bug report help explain the motivation?

@fb55
Copy link
Member

fb55 commented Sep 20, 2014

Okay, yeah. LGTM

fb55 added a commit that referenced this pull request Dec 25, 2014
Correct bug in implementation of `Cheerio#val`
@fb55 fb55 merged commit 7fc1003 into cheeriojs:master Dec 25, 2014
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