createElement function test
Last updated: 2026-03-05T12:26:14.088Z
Metrics
LOC: 12
Complexity: 3
Params: 5
Signature
createElement(
tag: string,
attrs: Record<string, string> = {},
parent?: Element,
): : HTMLElement
Source Code
function createElement(
tag: string,
attrs: Record<string, string> = {},
parent?: Element,
): HTMLElement {
const el = document.createElement(tag);
for (const [key, val] of Object.entries(attrs)) {
el.setAttribute(key, val);
}
(parent ?? document.body).appendChild(el);
return el;
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| extractSmartSelectors | uses |
| pickBestSelector | uses |
| getStableClasses | uses |
| buildCSSPath | uses |
| createElement | calls |
Impact (Incoming)
| Source | Type |
|---|---|
| createElement | calls |