mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-25 01:39:37 +01:00
🐛 add missing cases for href, src, class, xlink:href, textContent, innerText
This commit is contained in:
parent
951f589ceb
commit
0794659104
5
dist/dde-with-signals.js
vendored
5
dist/dde-with-signals.js
vendored
@ -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);
|
||||
|
5
dist/dde.js
vendored
5
dist/dde.js
vendored
@ -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);
|
||||
|
5
dist/esm-with-signals.js
vendored
5
dist/esm-with-signals.js
vendored
@ -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);
|
||||
|
5
dist/esm.js
vendored
5
dist/esm.js
vendored
@ -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);
|
||||
|
12
src/dom.js
12
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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user