mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
fix(html): prevent tsdown from stripping custom element registrations (#703)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
type DefinableElement = CustomElementConstructor & { tagName: string };
|
||||
|
||||
/** Define a custom element only if not already registered. */
|
||||
export function safeDefine(element: DefinableElement): void {
|
||||
if (!customElements.get(element.tagName)) {
|
||||
customElements.define(element.tagName, element);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user