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

Function getElementValue

test/select-value-observer.spec.js:14–34  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

12 });
13
14 function getElementValue (element) {
15 var options = element.options, option, i, ii, count = 0, value = [];
16
17 for (i = 0, ii = options.length; i < ii; i++) {
18 option = options.item(i);
19 if (!option.selected) {
20 continue;
21 }
22 value[count] = option.hasOwnProperty('model') ? option.model : option.value;
23 count++;
24 }
25
26 if (!element.multiple) {
27 if (count === 0) {
28 value = null;
29 } else {
30 value = value[0];
31 }
32 }
33 return value;
34 }
35
36 describe('single-select strings', () => {
37 var obj, el, binding;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected