mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
10 lines
252 B
TypeScript
10 lines
252 B
TypeScript
|
|
export function getOrAppendElement(tagName: string): Element {
|
|
const element = document.querySelector(tagName);
|
|
if (element) {
|
|
return element;
|
|
}
|
|
const tmp = document.createElement(tagName);
|
|
document.body.appendChild(tmp);
|
|
return tmp;
|
|
} |