(el, binding, vm)
| 11709 | } |
| 11710 | |
| 11711 | function actuallySetSelected(el, binding, vm) { |
| 11712 | var value = binding.value; |
| 11713 | var isMultiple = el.multiple; |
| 11714 | if (isMultiple && !Array.isArray(value)) { |
| 11715 | "development" !== 'production' && warn( |
| 11716 | "<select multiple v-model=\"" + (binding.expression) + "\"> " + |
| 11717 | "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)), |
| 11718 | vm |
| 11719 | ); |
| 11720 | return |
| 11721 | } |
| 11722 | var selected, option; |
| 11723 | for (var i = 0, l = el.options.length; i < l; i++) { |
| 11724 | option = el.options[i]; |
| 11725 | if (isMultiple) { |
| 11726 | selected = looseIndexOf(value, getValue(option)) > -1; |
| 11727 | if (option.selected !== selected) { |
| 11728 | option.selected = selected; |
| 11729 | } |
| 11730 | } else { |
| 11731 | if (looseEqual(getValue(option), value)) { |
| 11732 | if (el.selectedIndex !== i) { |
| 11733 | el.selectedIndex = i; |
| 11734 | } |
| 11735 | return |
| 11736 | } |
| 11737 | } |
| 11738 | } |
| 11739 | if (!isMultiple) { |
| 11740 | el.selectedIndex = -1; |
| 11741 | } |
| 11742 | } |
| 11743 | |
| 11744 | function hasNoMatchingOption(value, options) { |
| 11745 | return options.every(function (o) { |
no test coverage detected