MCPcopy Index your code
hub / github.com/microsoft/SandDance / select

Function select

docs/app/js/sanddance-app.js:142073–142097  ·  view source on GitHub ↗

* Generates a selection list input element.

(bind6, el, param, value3)

Source from the content-addressed store, hash-verified

142071/**
142072 * Generates a selection list input element.
142073 */ function select(bind6, el, param, value3) {
142074 const node = element("select", {
142075 name: param.signal
142076 }), labels = param.labels || [];
142077 param.options.forEach((option, i)=>{
142078 const attr = {
142079 value: option
142080 };
142081 if (valuesEqual(option, value3)) attr.selected = true;
142082 node.appendChild(element("option", attr, (labels[i] || option) + ""));
142083 });
142084 el.appendChild(node);
142085 node.addEventListener("change", ()=>{
142086 bind6.update(param.options[node.selectedIndex]);
142087 });
142088 bind6.elements = [
142089 node
142090 ];
142091 bind6.set = (value)=>{
142092 for(let i = 0, n = param.options.length; i < n; ++i)if (valuesEqual(param.options[i], value)) {
142093 node.selectedIndex = i;
142094 return;
142095 }
142096 };
142097}
142098/**
142099 * Generates a radio button group.
142100 */ function radio(bind7, el, param, value4) {

Callers

nothing calls this directly

Calls 4

elementFunction · 0.70
valuesEqualFunction · 0.70
forEachMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected