1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-22 07:49:38 +01:00

🐛 update dom.js to set/remove attributes ("xlink:href")

This commit is contained in:
Jan Andrle 2023-09-21 14:58:27 +02:00
parent 19051c256a
commit d20e2041f6
Signed by: jaandrle
GPG Key ID: B3A25AED155AFFAB
5 changed files with 27 additions and 5 deletions

View File

@ -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);

7
dist/dde.js vendored
View File

@ -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);

View File

@ -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);

7
dist/esm.js vendored
View File

@ -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);

View File

@ -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);