(
tag: K,
options: {
className?: string;
text?: string;
type?: string;
title?: string;
ariaHidden?: string;
ariaExpanded?: string;
disabled?: boolean;
} = {},
)
| 562 | } |
| 563 | |
| 564 | function element<K extends keyof HTMLElementTagNameMap>( |
| 565 | tag: K, |
| 566 | options: { |
| 567 | className?: string; |
| 568 | text?: string; |
| 569 | type?: string; |
| 570 | title?: string; |
| 571 | ariaHidden?: string; |
| 572 | ariaExpanded?: string; |
| 573 | disabled?: boolean; |
| 574 | } = {}, |
| 575 | ): HTMLElementTagNameMap[K] { |
| 576 | const node = document.createElement(tag); |
| 577 | if (options.className) node.className = options.className; |
| 578 | if (options.text !== undefined) node.textContent = options.text; |
| 579 | if (options.type !== undefined && "type" in node) node.setAttribute("type", options.type); |
| 580 | if (options.title !== undefined) node.title = options.title; |
| 581 | if (options.ariaHidden !== undefined) node.setAttribute("aria-hidden", options.ariaHidden); |
| 582 | if (options.ariaExpanded !== undefined) node.setAttribute("aria-expanded", options.ariaExpanded); |
| 583 | if (options.disabled !== undefined && "disabled" in node) { |
| 584 | (node as HTMLButtonElement).disabled = options.disabled; |
| 585 | } |
| 586 | return node; |
| 587 | } |
| 588 | |
| 589 | function iconSvg(children: string): string { |
| 590 | return `<svg aria-hidden="true" class="icon-svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8">${children}</svg>`; |
no outgoing calls
no test coverage detected