(el, binding, vm)
| 6745 | }; |
| 6746 | |
| 6747 | function setSelected (el, binding, vm) { |
| 6748 | var value = binding.value; |
| 6749 | var isMultiple = el.multiple; |
| 6750 | if (isMultiple && !Array.isArray(value)) { |
| 6751 | "development" !== 'production' && warn( |
| 6752 | "<select multiple v-model=\"" + (binding.expression) + "\"> " + |
| 6753 | "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)), |
| 6754 | vm |
| 6755 | ); |
| 6756 | return |
| 6757 | } |
| 6758 | var selected, option; |
| 6759 | for (var i = 0, l = el.options.length; i < l; i++) { |
| 6760 | option = el.options[i]; |
| 6761 | if (isMultiple) { |
| 6762 | selected = looseIndexOf(value, getValue(option)) > -1; |
| 6763 | if (option.selected !== selected) { |
| 6764 | option.selected = selected; |
| 6765 | } |
| 6766 | } else { |
| 6767 | if (looseEqual(getValue(option), value)) { |
| 6768 | if (el.selectedIndex !== i) { |
| 6769 | el.selectedIndex = i; |
| 6770 | } |
| 6771 | return |
| 6772 | } |
| 6773 | } |
| 6774 | } |
| 6775 | if (!isMultiple) { |
| 6776 | el.selectedIndex = -1; |
| 6777 | } |
| 6778 | } |
| 6779 | |
| 6780 | function hasNoMatchingOption (value, options) { |
| 6781 | for (var i = 0, l = options.length; i < l; i++) { |
no test coverage detected