From d20e2041f6c27a8a0f03eb138f9412a118a5c8c0 Mon Sep 17 00:00:00 2001 From: Jan Andrle Date: Thu, 21 Sep 2023 14:58:27 +0200 Subject: [PATCH] :bug: update dom.js to set/remove attributes ("xlink:href") --- dist/dde-with-signals.js | 7 ++++++- dist/dde.js | 7 ++++++- dist/esm-with-signals.js | 7 ++++++- dist/esm.js | 7 ++++++- src/dom.js | 4 +++- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/dist/dde-with-signals.js b/dist/dde-with-signals.js index df758e9..91e639a 100644 --- a/dist/dde-with-signals.js +++ b/dist/dde-with-signals.js @@ -94,7 +94,12 @@ case "src": case "class": case "xlink:href": - return i(f, a, "http://www.w3.org/1999/xlink"); + return i( + f, + a, + /* this applies only to SVG elements, see setRemove/setRemoveNS */ + "http://www.w3.org/1999/xlink" + ); case "textContent": case "innerText": return o ? e.appendChild(document.createTextNode(a)) : j(e, f, a); diff --git a/dist/dde.js b/dist/dde.js index 286084d..3ebd9b5 100644 --- a/dist/dde.js +++ b/dist/dde.js @@ -90,7 +90,12 @@ case "src": case "class": case "xlink:href": - return d(f, u, "http://www.w3.org/1999/xlink"); + return d( + f, + u, + /* this applies only to SVG elements, see setRemove/setRemoveNS */ + "http://www.w3.org/1999/xlink" + ); case "textContent": case "innerText": return c ? e.appendChild(document.createTextNode(u)) : R(e, f, u); diff --git a/dist/esm-with-signals.js b/dist/esm-with-signals.js index ac29b0e..5f98945 100644 --- a/dist/esm-with-signals.js +++ b/dist/esm-with-signals.js @@ -92,7 +92,12 @@ function w(e, ...t) { case "src": case "class": case "xlink:href": - return i(f, a, "http://www.w3.org/1999/xlink"); + return i( + f, + a, + /* this applies only to SVG elements, see setRemove/setRemoveNS */ + "http://www.w3.org/1999/xlink" + ); case "textContent": case "innerText": return o ? e.appendChild(document.createTextNode(a)) : j(e, f, a); diff --git a/dist/esm.js b/dist/esm.js index 464f246..f52d872 100644 --- a/dist/esm.js +++ b/dist/esm.js @@ -88,7 +88,12 @@ function x(e, ...t) { case "src": case "class": case "xlink:href": - return d(f, u, "http://www.w3.org/1999/xlink"); + return d( + f, + u, + /* this applies only to SVG elements, see setRemove/setRemoveNS */ + "http://www.w3.org/1999/xlink" + ); case "textContent": case "innerText": return c ? e.appendChild(document.createTextNode(u)) : R(e, f, u); diff --git a/src/dom.js b/src/dom.js index aeb0a88..3bdca90 100644 --- a/src/dom.js +++ b/src/dom.js @@ -56,7 +56,9 @@ export function assign(element, ...attributes){ } if("className"===key) key= "class"; switch(key){ - case "href": case "src": case "class": case "xlink:href": + case "href": case "src": case "class": + return setRemoveAttr(key, attr); + case "xlink:href": return setRemoveAttr(key, attr, "http://www.w3.org/1999/xlink"); case "textContent": case "innerText": if(!is_svg) return setDeleteAttr(element, key, attr);