From d5dc38f40fbe12482fe1c314c6aa6d6491836cbc Mon Sep 17 00:00:00 2001 From: Simon Green Date: Sun, 26 Jan 2025 11:01:10 -0700 Subject: [PATCH] use existing ID if assigned closes #101 --- package.json | 4 ++-- src/lib/internal/new-id.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5c98408..2356dc6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "svelte-headlessui", "description": "HeadlessUI components for Svelte", - "version": "0.0.45", + "version": "0.0.46", "type": "module", "keywords": [ "svelte", @@ -49,7 +49,7 @@ "homepage": "https://captaincodeman.github.io/svelte-headlessui/", "repository": { "type": "git", - "url": "https://github.com/captaincodeman/svelte-headlessui.git" + "url": "git+https://github.com/captaincodeman/svelte-headlessui.git" }, "author": { "name": "Simon Green", diff --git a/src/lib/internal/new-id.ts b/src/lib/internal/new-id.ts index 75eac30..6a83e8e 100644 --- a/src/lib/internal/new-id.ts +++ b/src/lib/internal/new-id.ts @@ -5,5 +5,5 @@ export function newID() { } export function ensureID(node: HTMLElement, prefix: string) { - node.id = `${prefix}:${newID()}` + node.id = node.id ||`${prefix}:${newID()}` }