mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 19:19:26 +08:00
9 lines
247 B
TypeScript
9 lines
247 B
TypeScript
export default function triggerEvent(el: Element, type: string) {
|
|
if ('createEvent' in document) {
|
|
// modern browsers, IE9+
|
|
const e = document.createEvent('HTMLEvents');
|
|
e.initEvent(type, false, true);
|
|
el.dispatchEvent(e);
|
|
}
|
|
}
|