Add initial_value attribute & fix static special attribute handling (#1063)

* feat & fix: initial_value attribute, special attribute handling

* revision: rename js file

* fix: rustfmt

* fix: clippy

* fix: desktop not finding common.js

* fix: desktop failing to render

Missed a single ``this.SetAttributeInner`` as it was now ``setAttributeInner``
Javascript didn't even throw any errors about this smh

* revision: no need for match statement
This commit is contained in:
Miles Murgaw authored and GitHub committed 2023-06-04 11:29:34 -05:00
1 parent 0f684f0567
commit d09c92beda
9 files changed
+82 -18

No files matched your search

+9 -4
View File
@@ -1,3 +1,5 @@
import { setAttributeInner } from "./common.js";
class ListenerMap {
constructor(root) {
// bubbling events can listen at the root element
@@ -153,10 +155,10 @@ class Interpreter {
this.RemoveAttribute(id, field, ns);
} else {
const node = this.nodes[id];
this.SetAttributeInner(node, field, value, ns);
setAttributeInner(node, field, value, ns);
}
}
SetAttributeInner(node, field, value, ns) {
/*SetAttributeInner(node, field, value, ns) {
const name = field;
if (ns === "style") {
// ????? why do we need to do this
@@ -173,6 +175,9 @@ class Interpreter {
node.value = value;
}
break;
case "initial_value":
node.defaultValue = value;
break;
case "checked":
node.checked = value === "true" || value === true;
break;
@@ -191,7 +196,7 @@ class Interpreter {
}
}
}
}
}*/
RemoveAttribute(root, field, ns) {
const name = field;
const node = this.nodes[root];
@@ -291,7 +296,7 @@ class Interpreter {
for (let attr of node.attrs) {
if (attr.type == "Static") {
this.SetAttributeInner(el, attr.name, attr.value, attr.namespace);
setAttributeInner(el, attr.name, attr.value, attr.namespace);
}
}