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

Need a .value property which reports actual value, not its label #138

Open
Typel opened this issue Apr 1, 2016 · 4 comments
Open

Need a .value property which reports actual value, not its label #138

Typel opened this issue Apr 1, 2016 · 4 comments

Comments

@Typel
Copy link

Typel commented Apr 1, 2016

value property is misleading as it does not report the value of the selected paper-item, but rather its innerHTML (label).

In this scenario:

<paper-dropdown-menu id="test">
<paper-menu class="dropdown-content">
<paper-item value="selectedItemValue">selectedItemLabel</paper-item>
</paper-menu>
</paper-dropdown-menu>

Using this:
document.querySelector('#test').value
Returns:
selectedItemLabel

Given its name, I would have expected the .value property to report the selected paper-item's value (selectedItemValue in the example) rather than its label. It is documented as such, so I assume this is an intentional decision, but shouldn't there be a similar readonly property which actually looks up its value as well? Might I suggest selectedItemValue?

@34code
Copy link

34code commented Apr 3, 2016

👍 -- @Typel thanks for the thorough description .. i was able to solve a related issue with this

@SPAHI4
Copy link

SPAHI4 commented Jun 28, 2016

+1
I think .value must returns selectedItem.value if passed or selectedItem.textContent if not.
Similar to native

@Typel
Copy link
Author

Typel commented Jul 22, 2016

Under current specs, I don't see that there is any way to retrieve the selected value at all - only its label. Does anybody know of a workaround?

@mercmobily
Copy link

This is a pending PR for this, but it hasn't been checked yet and it may never be accepted or it may be changed in the meantime.

For my own app, I am currently monkey-patching it... #195

If you do go for the money-patching way, make sure you use the snippet in the PR, since it's the latest incarnation.

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

No branches or pull requests

4 participants