A helper function used by the 'change' handler below. Its purpose is to return an array of selected values, like ["foo", "bar"]
970030
function() {
                        var values = [],
                            children = this.element[0].childNodes;

                        can.each(children, function(child) {
                            if (child.selected && child.value) {
                                values.push(child.value);
                            }
                        });

                        return values;
                    }
309915
def selected(self, new):
        
        def preprocess(item):
            if isinstance(item, str):
                return self.options[item]
            return item
        items = coerce_to_list(new, preprocess)
        self.widget.value = items
1113521
function onchange(array, index, removed, added) {
		edb.Array.$onchange(array, index, removed, added);
	}
1265352
function(arrayOfValues) {
        var i = 0,
            currentLength,
            finishedString = '';

        for (; i < arrayOfValues.length; i++) {
            currentLength = i + 1;

            if (currentLength === arrayOfValues.length) {
                finishedString += ' and ' + arrayOfValues[i];
            }
            else if (i === 0) {
                finishedString += arrayOfValues[i];
            }
            else {
                finishedString += ', ' + arrayOfValues[i];
            }
        }

        return finishedString;
    }
923851
function(length) {
			var out = [];
			while (this.length > length) {
				out.push(this.pop());
			}
			if (out.length) {
				onchange(this, this.length - 1, out);
			}
		}
1169164
function(values) {
      Object.keys(values).forEach(function(name) {
        this.find("[name='" + name + "']").each(function() {
          if (this.is("textarea")) {
            this.text(values[name]);
          } else if (this.is("select")) {
            this.find("option[value='" + values[name] + "']")
              .attr("selected","selected");
          } else {
            this.attr("value",values[name]);
          }
        });
      }.bind(this));
      return this;
    }
765536
function GetValues(mydata, keys, index)
{
	//Output
	var values = [];
	
	//Loop
	for(var j = 0; j < keys.length; j++)
	{
		//Save data value
		var value = mydata[keys[j]];
		
		//Check if value exists
		if(!value)
		{
			//Show warning
			console.log('WARNING: value "' + keys[j] + '" is not defined on element "' + index + '" of your array.');
			
			//Set it to empty string
			value = '';
		}
		
		//Check the data type
		if(typeof value === 'string' || value instanceof String)
		{
			//Add the quotes
			value = '"' + value + '"';
		}
		
		//Push
		values.push(value);
	}
	
	//Return
	return values.join(',');
}
508313
@SuppressWarnings("squid:S1168")
    public String[] selectedValues() {
        if (isNotPresentSelect()) {
            return null;    // returning an empty array could be confused with no values selected
        }
        WebElement webElement = element.getWebElement();
        Select dropdown = new Select(webElement);
        List<WebElement> options = dropdown.getAllSelectedOptions();
        String[] stringOptions = new String[options.size()];
        for (int i = 0; i < options.size(); i++) {
            stringOptions[i] = options.get(i).getAttribute(VALUE);
        }
        return stringOptions;
    }
830014
function _handleDataSelectorChange () {
    let chartType = getCurrentType();
    let dataType = d3.select(`.${dataSelectorClass}`).property('value');
    let currentData = defaultData[chartType][dataType];

    storage.setDataByKey(savedDataKey, currentData);
    updateAllComponents();
}
268249
function (data) {
        var items = [];
        data.forEach(function (d, i) {
            if (d.includes('ITEM:') && d.length > 3) {
                var iid = data[i + 1];
                var item = {
                    item: {
                        id: Number(iid[1].trim()),
                        name: d[2].replace(/_/g, ' '),
                        price: d[3],
                        change: d[4]
                    }
                };
                items.push(item);
            }
        });
        return items;
    }
1127759
function(rowIndex) {
        if (typeof rowIndex !== 'undefined') {
            if ($.isArray(rowIndex)) {
                var result = [],
                    self = this;
                $.each(rowIndex, function(index, value) {
                    var item = self.options.data[value - 1];
                    if (item) {
                        result.push(item);
                    }
                });
                return result.length !== 0 ? result : null;
            } else {
                return this.options.data[rowIndex - 1] || null;
            }
        } else {
            return this.options.data;
        }
    }
709529
function wrapInList(
    opts: Options,
    change: Change,
    type?: string,
    data?: Object | Data
): Change {
    const selectedBlocks = getHighestSelectedBlocks(change.value);
    type = type || opts.types[0];

    // Wrap in container
    change.wrapBlock(
        {
            type,
            data: Data.create(data)
        },
        { normalize: false }
    );

    // Wrap in list items
    selectedBlocks.forEach(node => {
        if (isList(opts, node)) {
            // Merge its items with the created list
            node.nodes.forEach(({ key }) =>
                change.unwrapNodeByKey(key, { normalize: false })
            );
        } else {
            change.wrapBlockByKey(node.key, opts.typeItem, {
                normalize: false
            });
        }
    });

    return change.normalize();
}
85009
function shift(arr) {
    var shifted = splice(arr, 0, 1);
    return {
        array: shifted.array,
        val: arr[0]
    };
}
1033639
function() {
                        // Get an array of the currently selected values
                        var value = this.get(),
                            currentValue = this.options.value();

                        // If the compute is a string, set its value to the joined version of the values array (i.e. "foo;bar")
                        if (this.isString || typeof currentValue === "string") {
                            this.isString = true;
                            this.options.value(value.join(this.delimiter));
                        }
                        // If the compute is a can.List, replace its current contents with the new array of values
                        else if (currentValue instanceof can.List) {
                            currentValue.attr(value, true);
                        }
                        // Otherwise set the value to the array of values selected in the input.
                        else {
                            this.options.value(value);
                        }

                    }
222805
function changeDropdownIndex(page, ph, selectorAndIndex, callback) {
    page.evaluate(function (selectorAndIndex) {
        try {
            var selector = selectorAndIndex[0];
            var index = selectorAndIndex[1];

            var element = document.querySelector(selector);
            element.selectedIndex = index;

            // event is needed because listeners to the change do not react to
            // programmatic changes
            var event = document.createEvent('Event');
            event.initEvent('change', true, false);
            element.dispatchEvent(event);
            return null;
        } catch (error) {
            return error;
        }
    }, function (error) {
        // do this because if there is no error, the error is still something so we can't simply do callback(error, page, ph);
        if (error) {
            callback(error, page, ph);
            return;
        }
        callback(null, page, ph);
    }, selectorAndIndex);
}
251931
function() {
    var value = this.get();

    // Don't call the callback if `skipNextSync` was called on the observer
    if (this.skip || !this.callback) {
      this.skip = false;

      if (this.getChangeRecords) {
        // Store an immutable version of the value, allowing for arrays and objects to change instance but not content and
        // still refrain from dispatching callbacks (e.g. when using an object in bind-class or when using array formatters
        // in bind-each)
        this.oldValue = diff.clone(value);
      } else {
        this.oldValue = value;
      }
    } else {
      var change;
      var useCompareBy = this.getChangeRecords &&
                         this.compareBy &&
                         Array.isArray(value) &&
                         Array.isArray(this.oldValue);

      if (useCompareBy) {
        var compareExpression = this.compareBy;
        var name = this.compareByName;
        var index = this.compareByIndex || '__index__';
        var ctx = this.context;
        var globals = this.observations.globals;
        var formatters = this.observations.formatters;
        var oldValue = this.oldValue;
        if (!name) {
          name = '__item__';
          // Turn "id" into "__item__.id"
          compareExpression = name + '.' + compareExpression;
        }

        var getCompareValue = expressions.parse(compareExpression, globals, formatters, name, index);
        changed = diff.values(value.map(getCompareValue, ctx), oldValue.map(getCompareValue, ctx));
      } else if (this.getChangeRecords) {
        changed = diff.values(value, this.oldValue);
      } else {
        changed = diff.basic(value, this.oldValue);
      }

      var oldValue = this.oldValue;

      if (this.getChangeRecords) {
        // Store an immutable version of the value, allowing for arrays and objects to change instance but not content and
        // still refrain from dispatching callbacks (e.g. when using an object in bind-class or when using array formatters
        // in bind-each)
        this.oldValue = diff.clone(value);
      } else {
        this.oldValue = value;
      }

      // If an array has changed calculate the splices and call the callback.
      if (!changed && !this.forceUpdateNextSync) return;
      this.forceUpdateNextSync = false;
      if (Array.isArray(changed)) {
        this.callback.call(this.callbackContext, value, oldValue, changed);
      } else {
        this.callback.call(this.callbackContext, value, oldValue);
      }
    }
  }
314919
function (args) {
            if (this._updatesStopped()) {
                return;
            }
            var dataName = args.dataName;
            if (dataName == "selected") {
                var item = args.dataHolder;
                if ((args.newValue && !args.oldValue) // item was just selected
                        || (!args.newValue && args.oldValue) // item was just unselected
                ) {
                    this._selectionChanged(item.index);
                }
            } else if (dataName == "initiallyDisabled") {
                this._updateCurrentlyDisabled([args.dataHolder]);
            }
        }