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