|
|
@@ -1,10 +1,14 @@ |
|
|
|
const TAG_NAME_ELEMENT_CONSTRUCTOR = { |
|
|
|
'INPUT': window.HTMLInputElement, |
|
|
|
'SELECT': window.HTMLSelectElement, |
|
|
|
'TEXTAREA': window.HTMLTextAreaElement, |
|
|
|
} as const; |
|
|
|
|
|
|
|
export const delegateTriggerChangeEvent = <T extends HTMLElement>(target: T, value?: unknown) => { |
|
|
|
if (typeof window === 'undefined') { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const TAG_NAME_ELEMENT_CONSTRUCTOR = { |
|
|
|
'INPUT': window.HTMLInputElement, |
|
|
|
'SELECT': window.HTMLSelectElement, |
|
|
|
'TEXTAREA': window.HTMLTextAreaElement, |
|
|
|
} as const; |
|
|
|
|
|
|
|
const { [target.tagName as keyof typeof TAG_NAME_ELEMENT_CONSTRUCTOR]: elementCtor } = TAG_NAME_ELEMENT_CONSTRUCTOR; |
|
|
|
|
|
|
|
if (!elementCtor) { |
|
|
|