diff --git a/dist/dde-with-signals.js b/dist/dde-with-signals.js index db9a978..0084079 100644 --- a/dist/dde-with-signals.js +++ b/dist/dde-with-signals.js @@ -90,6 +90,7 @@ if (typeof a == "object" && a !== null && !Array.isArray(a)) switch (s) { case "style": + case "dataset": return N(r, a, T.bind(null, e[s])); case "ariaset": return N(r, a, (E, c) => i("aria-" + E, c)); @@ -102,8 +103,12 @@ return s = s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), i(s, a); switch (s === "className" && (s = "class"), s) { case "href": + case "src": + case "class": + case "xlink:href": return i(s, a, "http://www.w3.org/1999/xlink"); case "textContent": + case "innerText": return o ? e.appendChild(document.createTextNode(a)) : j(e, s, a); } return H(e, s) ? j(e, s, a) : i(s, a); diff --git a/dist/dde.js b/dist/dde.js index 094f2d1..2ecb3e9 100644 --- a/dist/dde.js +++ b/dist/dde.js @@ -86,6 +86,7 @@ if (typeof u == "object" && u !== null && !Array.isArray(u)) switch (f) { case "style": + case "dataset": return O(n, u, D.bind(null, e[f])); case "ariaset": return O(n, u, (E, o) => d("aria-" + E, o)); @@ -98,8 +99,12 @@ return f = f.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), d(f, u); switch (f === "className" && (f = "class"), f) { case "href": + case "src": + case "class": + case "xlink:href": return d(f, u, "http://www.w3.org/1999/xlink"); case "textContent": + case "innerText": return c ? e.appendChild(document.createTextNode(u)) : R(e, f, u); } return _(e, f) ? R(e, f, u) : d(f, u); diff --git a/dist/esm-with-signals.js b/dist/esm-with-signals.js index 3fb5e7a..6d1725c 100644 --- a/dist/esm-with-signals.js +++ b/dist/esm-with-signals.js @@ -88,6 +88,7 @@ function w(e, ...t) { if (typeof a == "object" && a !== null && !Array.isArray(a)) switch (s) { case "style": + case "dataset": return N(r, a, T.bind(null, e[s])); case "ariaset": return N(r, a, (E, c) => i("aria-" + E, c)); @@ -100,8 +101,12 @@ function w(e, ...t) { return s = s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), i(s, a); switch (s === "className" && (s = "class"), s) { case "href": + case "src": + case "class": + case "xlink:href": return i(s, a, "http://www.w3.org/1999/xlink"); case "textContent": + case "innerText": return o ? e.appendChild(document.createTextNode(a)) : j(e, s, a); } return H(e, s) ? j(e, s, a) : i(s, a); diff --git a/dist/esm.js b/dist/esm.js index aa94116..1e946ae 100644 --- a/dist/esm.js +++ b/dist/esm.js @@ -84,6 +84,7 @@ function x(e, ...t) { if (typeof u == "object" && u !== null && !Array.isArray(u)) switch (f) { case "style": + case "dataset": return O(n, u, D.bind(null, e[f])); case "ariaset": return O(n, u, (E, o) => d("aria-" + E, o)); @@ -96,8 +97,12 @@ function x(e, ...t) { return f = f.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), d(f, u); switch (f === "className" && (f = "class"), f) { case "href": + case "src": + case "class": + case "xlink:href": return d(f, u, "http://www.w3.org/1999/xlink"); case "textContent": + case "innerText": return c ? e.appendChild(document.createTextNode(u)) : R(e, f, u); } return _(e, f) ? R(e, f, u) : d(f, u); diff --git a/src/dom.js b/src/dom.js index 9b50b16..187fa33 100644 --- a/src/dom.js +++ b/src/dom.js @@ -52,10 +52,10 @@ export function assign(element, ...attributes){ if("."===k) return setDelete(element, key.slice(1), attr); if(typeof attr === "object" && attr!==null && !Array.isArray(attr)){ switch(key){ - case "style" || "dataset": return forEachEntries(s, attr, setDelete.bind(null, element[key])); - case "ariaset": return forEachEntries(s, attr, (key, val)=> setRemoveAttr("aria-"+key, val)); - case "classList": return classListDeclarative.call(_this, element, attr); - default: return Reflect.set(element, key, attr); + case "style": case "dataset": return forEachEntries(s, attr, setDelete.bind(null, element[key])); + case "ariaset": return forEachEntries(s, attr, (key, val)=> setRemoveAttr("aria-"+key, val)); + case "classList": return classListDeclarative.call(_this, element, attr); + default: return Reflect.set(element, key, attr); } } if(/(aria|data)([A-Z])/.test(key)){ @@ -64,9 +64,9 @@ export function assign(element, ...attributes){ } if("className"===key) key= "class"; switch(key){ - case "href" || "src" || "class" || "xlink:href": + case "href": case "src": case "class": case "xlink:href": return setRemoveAttr(key, attr, "http://www.w3.org/1999/xlink"); - case "textContent" || "innerText": + case "textContent": case "innerText": if(!is_svg) return setDeleteAttr(element, key, attr); return element.appendChild(document.createTextNode(attr)); }