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

Select value doesn't fallback to text content when value is undefined #633

Closed
twolfson opened this issue Jan 20, 2015 · 1 comment
Closed

Comments

@twolfson
Copy link
Contributor

In browsers, el.value for an <option> will fallback from getAttribute('value') to the inner content of a node. Since jQuery executes in the browser, it gets this for free when it asks for el.value. However, Cheerio currently does not support this behavior. As a result:

<select><option selected>Hello</option></select>

$('select').val() will return [undefined] via Cheerio and ['Hello'] via jQuery.

@twolfson
Copy link
Contributor Author

I belive I spoke to soon. It looks like this only applies to multiple select's.

<select multiple><option selected>Hello</option></select>

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

No branches or pull requests

1 participant