MCPcopy Create free account
hub / github.com/aurelia/binding / synchronizeOptions

Method synchronizeOptions

src/select-value-observer.js:52–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 }
51
52 synchronizeOptions() {
53 let value = this.value;
54 let isArray;
55
56 if (Array.isArray(value)) {
57 isArray = true;
58 }
59
60 let options = this.element.options;
61 let i = options.length;
62 let matcher = this.element.matcher || ((a, b) => a === b);
63 while (i--) {
64 let option = options.item(i);
65 let optionValue = option.hasOwnProperty('model') ? option.model : option.value;
66 if (isArray) {
67 option.selected = value.findIndex(item => !!matcher(optionValue, item)) !== -1; // eslint-disable-line no-loop-func
68 continue;
69 }
70 option.selected = !!matcher(optionValue, value);
71 }
72 }
73
74 synchronizeValue() {
75 let options = this.element.options;

Callers 5

setValueMethod · 0.95
callMethod · 0.95
bindMethod · 0.95
aurelia-binding.jsFile · 0.80
aurelia-binding.jsFile · 0.80

Calls 1

matcherFunction · 0.85

Tested by

no test coverage detected