From fc87c009806dcc98867f6b58efe29b042aa01dee Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 18 May 2026 23:10:59 +0800 Subject: node: update --- node_modules/swup/src/modules/getAnchorElement.ts | 32 ----------------------- 1 file changed, 32 deletions(-) delete mode 100755 node_modules/swup/src/modules/getAnchorElement.ts (limited to 'node_modules/swup/src/modules/getAnchorElement.ts') diff --git a/node_modules/swup/src/modules/getAnchorElement.ts b/node_modules/swup/src/modules/getAnchorElement.ts deleted file mode 100755 index b25de2bc..00000000 --- a/node_modules/swup/src/modules/getAnchorElement.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { query } from '../utils.js'; - -/** - * Find the anchor element for a given hash. - * - * @param hash Hash with or without leading '#' - * @returns The element, if found, or null. - * - * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element - */ -export const getAnchorElement = (hash?: string): Element | null => { - if (hash && hash.charAt(0) === '#') { - hash = hash.substring(1); - } - - if (!hash) { - return null; - } - - const decoded = decodeURIComponent(hash); - let element = - document.getElementById(hash) || - document.getElementById(decoded) || - query(`a[name='${CSS.escape(hash)}']`) || - query(`a[name='${CSS.escape(decoded)}']`); - - if (!element && hash === 'top') { - element = document.body; - } - - return element; -}; -- cgit v1.2.3