(el, binding, vm)
| 6297 | }; |
| 6298 | |
| 6299 | function setSelected (el, binding, vm) { |
| 6300 | var value = binding.value; |
| 6301 | var isMultiple = el.multiple; |
| 6302 | if (isMultiple && !Array.isArray(value)) { |
| 6303 | "development" !== 'production' && warn( |
| 6304 | "<select multiple v-model=\"" + (binding.expression) + "\"> " + |
| 6305 | "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)), |
| 6306 | vm |
| 6307 | ); |
| 6308 | return |
| 6309 | } |
| 6310 | var selected, option; |
| 6311 | for (var i = 0, l = el.options.length; i < l; i++) { |
| 6312 | option = el.options[i]; |
| 6313 | if (isMultiple) { |
| 6314 | selected = looseIndexOf(value, getValue(option)) > -1; |
| 6315 | if (option.selected !== selected) { |
| 6316 | option.selected = selected; |
| 6317 | } |
| 6318 | } else { |
| 6319 | if (looseEqual(getValue(option), value)) { |
| 6320 | if (el.selectedIndex !== i) { |
| 6321 | el.selectedIndex = i; |
| 6322 | } |
| 6323 | return |
| 6324 | } |
| 6325 | } |
| 6326 | } |
| 6327 | if (!isMultiple) { |
| 6328 | el.selectedIndex = -1; |
| 6329 | } |
| 6330 | } |
| 6331 | |
| 6332 | function hasNoMatchingOption (value, options) { |
| 6333 | for (var i = 0, l = options.length; i < l; i++) { |
no test coverage detected