Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

core-selector doc is misleading about .selected, .valueattr, .selectedIndex #31

Open
arthurevans opened this issue Jan 30, 2015 · 1 comment

Comments

@arthurevans
Copy link

There are several confusing items here that you need to read the code to determine:

  1. selectedIndex appears to be read-only. From reading the doc, you might reasonably expect mySelector.selectedIndex = 2 to update the selection, but it doesn't.

  2. The valueattr doc and selected docs say that the default value attribute is name. What they don't say is that IF the items don't have name attributes, OR if there's no item with a matching name, then the selected value is treated as an index.

  3. So if you want to be able to select items by index, you need to set valueattr to an attribute that's NOT defined on any of your items.

@arthurevans
Copy link
Author

Hm. Apparently I should RTFM. All of these things are actually noted in the doc for the individual properties. I feel like they should be clearer in the general discussion though. The workings of the selected property are pretty complicated.

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

No branches or pull requests

1 participant