makeSelect function infrastructure
Last updated: 2026-03-02T13:35:57.085Z
Metrics
LOC: 56
Complexity: 4
Params: 1
Signature
makeSelect(options?: {
disabled?: boolean;
placeholder?: string;
hasOptions?: boolean;
}): : HTMLElement
Source Code
function makeSelect(options?: {
disabled?: boolean;
placeholder?: string;
hasOptions?: boolean;
}): HTMLElement {
const wrapper = document.createElement("div");
wrapper.className = "ant-select ant-select-single";
if (options?.disabled) wrapper.classList.add("ant-select-disabled");
const selector = document.createElement("div");
selector.className = "ant-select-selector";
const searchSpan = document.createElement("span");
searchSpan.className = "ant-select-selection-search";
const input = document.createElement("input");
input.setAttribute("role", "combobox");
input.className = "ant-select-selection-search-input";
if (options?.placeholder) {
const placeholder = document.createElement("span");
placeholder.className = "ant-select-selection-placeholder";
placeholder.textContent = options.placeholder;
selector.appendChild(placeholder);
}
searchSpan.appendChild(input);
selector.appendChild(searchSpan);
wrapper.appendChild(selector);
if (options?.hasOptions) {
// Create a fake listbox with aria-controls
const listboxId = "antd-listbox-test";
input.setAttribute("aria-controls", listboxId);
const listbox = document.createElement("ul");
listbox.id = listboxId;
listbox.setAttribute("role", "listbox");
const opt1 = document.createElement("li");
opt1.setAttribute("role", "option");
opt1.setAttribute("title", "Opção 1");
opt1.textContent = "Opção 1";
const opt2 = document.createElement("li");
opt2.setAttribute("role", "option");
opt2.setAttribute("title", "Opção 2");
opt2.textContent = "Opção 2";
listbox.appendChild(opt1);
listbox.appendChild(opt2);
document.body.appendChild(listbox);
}
return wrapper;
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| waitForElement | uses |
| makeSelect | calls |
| makeNewCssVarSelect | calls |
| makeMultipleSelect | calls |
| makeDropdownWithOptions | calls |
| makeDatepicker | calls |
| makeTimePicker | calls |
| makeSlider | calls |
Impact (Incoming)
| Source | Type |
|---|---|
| makeSelect | calls |
| makeMultipleSelect | calls |