MCPcopy
hub / github.com/Robdel12/DropKick / buildSelect

Function buildSelect

tests/utils/utils.js:22–46  ·  view source on GitHub ↗
(id, options, isMultiSelect = false, appendEl)

Source from the content-addressed store, hash-verified

20 * @returns { DOM Node } selectEl - newly created select element
21 */
22export function buildSelect(id, options, isMultiSelect = false, appendEl) {
23 let selectEl = document.getElementById(id);
24
25 if (selectEl) { return selectEl; }
26
27 selectEl = document.createElement("select");
28 let testingContainerEl = document.getElementById('testingContainer');
29 // if nothing is passed, append to the normal container
30 if (!appendEl) { appendEl = testingContainerEl;}
31
32 selectEl.id = id;
33 selectEl.multiple = isMultiSelect;
34 appendEl.appendChild(selectEl);
35
36 options.forEach(option => {
37 let optionEl = document.createElement("option");
38
39 optionEl.value = option;
40 optionEl.text = option;
41
42 selectEl.appendChild(optionEl);
43 });
44
45 return selectEl;
46}
47
48/**
49 * Create an iframe and append it to the testing container

Callers 5

cache-test.jsFile · 0.90
mobile-test.jsFile · 0.90
jquery-test.jsFile · 0.90
dropkick-test.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected