Web Dev Solutions

Catalin Mititiuc

From 8bd67fbee2575bbcc83a4cf7f03f2c4aa5828b92 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Thu, 4 Apr 2024 15:52:56 -0700 Subject: Fix using duplicate ids for counters and clip paths --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ca8f618..7ed64e3 100644 --- a/index.js +++ b/index.js @@ -583,7 +583,7 @@ const RecordSheet = new function() { unclipped.forEach(el => { let { troopNumber, troopAllegiance } = el.dataset; - el.setAttributeNS(null, 'clip-path', `url(#${troopAllegiance}-${troopNumber})`); + el.setAttributeNS(null, 'clip-path', `url(#clip-path-${troopAllegiance}-${troopNumber})`); }); }; @@ -825,7 +825,7 @@ document.querySelectorAll('.set-firing-arc').forEach(el => el.addEventListener(' clipShape.setAttributeNS(null, 'r', 100); let clipPath = document.createElementNS(svgns, 'clipPath'); - clipPath.setAttributeNS(null, 'id', `${troopAllegiance}-${troopNumber}`); + clipPath.setAttributeNS(null, 'id', `clip-path-${troopAllegiance}-${troopNumber}`); clipPath.dataset.troopNumber = troopNumber; clipPath.dataset.troopAllegiance = troopAllegiance; clipPath.appendChild(clipShape); -- cgit v1.2.3