From 9cf1d7a862a00ef43db7a99784a4e3b6ddf52f0c Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Mon, 18 Mar 2024 11:17:17 +0800 Subject: [PATCH 1/3] Update dependencies (#51) --- .github/workflows/ci.yml | 1 - delegate.ts | 6 +++--- one-event.ts | 1 - package.json | 14 +++++++------- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d6b2d8..b5c7195 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,5 +24,4 @@ jobs: steps: - uses: actions/checkout@v3 - run: npm install - - run: npm run build - run: npx vitest diff --git a/delegate.ts b/delegate.ts index 0ea558b..34659f0 100644 --- a/delegate.ts +++ b/delegate.ts @@ -113,13 +113,13 @@ function delegate< // Handle the regular Element usage const capture = Boolean(typeof options === 'object' ? options.capture : options); - const listenerFn = (event: Event): void => { + const listenerFunction = (event: Event): void => { const delegateTarget = safeClosest(event, selector); if (delegateTarget) { const delegateEvent = Object.assign(event, {delegateTarget}); callback.call(baseElement, delegateEvent as DelegateEvent); if (once) { - baseElement.removeEventListener(type, listenerFn, nativeListenerOptions); + baseElement.removeEventListener(type, listenerFunction, nativeListenerOptions); editLedger(false, baseElement, callback, setup); } } @@ -128,7 +128,7 @@ function delegate< const setup = JSON.stringify({selector, type, capture}); const isAlreadyListening = editLedger(true, baseElement, callback, setup); if (!isAlreadyListening) { - baseElement.addEventListener(type, listenerFn, nativeListenerOptions); + baseElement.addEventListener(type, listenerFunction, nativeListenerOptions); } signal?.addEventListener('abort', () => { diff --git a/one-event.ts b/one-event.ts index d07ae32..fb62414 100644 --- a/one-event.ts +++ b/one-event.ts @@ -50,7 +50,6 @@ async function oneEvent< delegate( selector, type, - // @ts-expect-error Seems to work fine resolve, options, ); diff --git a/package.json b/package.json index 57f74e5..852aa7b 100644 --- a/package.json +++ b/package.json @@ -48,14 +48,14 @@ } }, "dependencies": { - "typed-query-selector": "^2.10.0" + "typed-query-selector": "^2.11.2" }, "devDependencies": { - "@sindresorhus/tsconfig": "^3.0.1", - "@types/jsdom": "^21.1.1", - "jsdom": "^21.1.1", - "typescript": "^5.0.4", - "vitest": "^0.30.1", - "xo": "^0.54.1" + "@sindresorhus/tsconfig": "^5.0.0", + "@types/jsdom": "^21.1.6", + "jsdom": "^24.0.0", + "typescript": "^5.4.2", + "vitest": "^1.3.1", + "xo": "^0.58.0" } } From 8ed8f36c2ed252c494fc114d5abdca613d83db5b Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Mon, 18 Mar 2024 11:20:16 +0800 Subject: [PATCH 2/3] Drop outdated mentions of browsers --- readme.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/readme.md b/readme.md index 05d89f4..e5fbe73 100644 --- a/readme.md +++ b/readme.md @@ -12,8 +12,6 @@ This is a fork of the popular but abandoned [`delegate`](https://github.com/zeno - debugged ([2d54c11](https://github.com/fregante/delegate-it/commit/2d54c1182aefd3ec9d8250fda76290971f5d7166), [c6bb88c](https://github.com/fregante/delegate-it/commit/c6bb88c2aa8097b25f22993a237cf09c96bcbfb8)) - supports [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) -If you need IE support, you can keep using [`delegate`](https://github.com/zenorocha/delegate) - ## Install ``` @@ -109,13 +107,6 @@ const someEventType2: EventType = 'click'; // all good const someEventType3: EventType = 'some-invalid-event-type'; // no good ``` -## Browser Support - -| Chrome logo | Edge logo | Firefox logo | Internet Explorer logo | Opera logo | Safari logo | -|:---:|:---:|:---:|:---:|:---:|:---:| -| Latest ✔ | Latest ✔ | Latest ✔ | No ✕ | Latest ✔ | Latest ✔ | - - ## Related - [select-dom](https://github.com/fregante/select-dom) - Lightweight `querySelector`/`All` wrapper that outputs an Array. From 5e68bc3c863ed26111224426fbd34a42064f75ca Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Mon, 18 Mar 2024 22:51:27 +0800 Subject: [PATCH 3/3] 6.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 852aa7b..ad02927 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "delegate-it", - "version": "6.0.1", + "version": "6.1.0", "description": "Lightweight and modern event delegation in the browser", "keywords": [ "delegate",