From a357a7a1e8af88f52dcfde78cc34d40ccff02354 Mon Sep 17 00:00:00 2001 From: koirodev Date: Wed, 19 Nov 2025 14:54:18 +0300 Subject: [PATCH] feat(core): support both xlink:href and href attributes for SVG use --- CHANGELOG.md | 8 ++++++++ package-lock.json | 4 ++-- package.json | 2 +- src/core/managers/IconManager.mjs | 18 +++++++++++++----- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b7bf6..5da0a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 4.1.10 - Released on 2025-11-19 + +### Features + +- Added support both `xlink:href` and `href` attributes for SVG `` tags in IconManager. + +
+ ## 4.1.9 - Released on 2025-09-24 ### Features diff --git a/package-lock.json b/package-lock.json index 09cb46b..26fc528 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "prismium-src", - "version": "4.1.9", + "version": "4.1.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "prismium-src", - "version": "4.1.9", + "version": "4.1.10", "license": "MIT", "devDependencies": { "@csstools/postcss-is-pseudo-class": "5.0.1", diff --git a/package.json b/package.json index de686fa..958bfdb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prismium-src", - "version": "4.1.9", + "version": "4.1.10", "description": "A modern JavaScript accordion library with smooth animations. Easily integrates with React, Vue, and vanilla JavaScript.", "type": "module", "scripts": { diff --git a/src/core/managers/IconManager.mjs b/src/core/managers/IconManager.mjs index 33ffd32..bc48bd3 100644 --- a/src/core/managers/IconManager.mjs +++ b/src/core/managers/IconManager.mjs @@ -32,11 +32,19 @@ export class IconManager { if (!useTag) return; const icon = state === 'open' ? this.icon.close : this.icon.open; - useTag.setAttributeNS( - 'http://www.w3.org/1999/xlink', - 'xlink:href', - `${this.instance.options.spritePath}#${icon}` - ); + + if (useTag.hasAttribute('xlink:href')) { + useTag.setAttributeNS( + 'http://www.w3.org/1999/xlink', + 'xlink:href', + `${this.instance.options.spritePath}#${icon}` + ); + } else { + useTag.setAttribute( + 'href', + `${this.instance.options.spritePath}#${icon}` + ); + } } if (this.icon.type === 'multiple') {