diff --git a/index.ts b/index.ts index de786c0..ea2f8e3 100644 --- a/index.ts +++ b/index.ts @@ -54,7 +54,7 @@ function editLedger( } function isEventTarget( - elements: EventTarget | Document | ArrayLike | string, + elements: EventTarget | Document | Iterable | string, ): elements is EventTarget { return typeof (elements as EventTarget).addEventListener === 'function'; } @@ -83,7 +83,7 @@ function delegate< TElement extends Element = ParseSelector, TEventType extends EventType = EventType, >( - base: EventTarget | Document | ArrayLike | string, + base: EventTarget | Document | Iterable | string, selector: Selector, type: TEventType, callback: DelegateEventHandler, @@ -94,7 +94,7 @@ function delegate< TElement extends Element = HTMLElement, TEventType extends EventType = EventType, >( - base: EventTarget | Document | ArrayLike | string, + base: EventTarget | Document | Iterable | string, selector: string, type: TEventType, callback: DelegateEventHandler, @@ -106,7 +106,7 @@ function delegate< TElement extends Element, TEventType extends EventType = EventType, >( - base: EventTarget | Document | ArrayLike | string, + base: EventTarget | Document | Iterable | string, selector: string, type: TEventType, callback: DelegateEventHandler, @@ -137,9 +137,9 @@ function delegate< // Handle Array-like based usage if (!isEventTarget(base)) { - Array.prototype.forEach.call(base, element => { + for (const element of base) { delegate(element, selector, type, callback, listenerOptions); - }); + } return internalController; } diff --git a/package.json b/package.json index b1ed909..fa7c95d 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ ], "rules": { "max-params": "off", - "@typescript-eslint/no-namespace": "off", "@typescript-eslint/naming-convention": "off" } },