remove attributes with the None value

This commit is contained in:
Evan Almloff committed 2023-01-03 08:51:48 -06:00
1 parent cb2d672105
commit ea43b864db
3 files changed
+34 -26

No files matched your search

+9 -5
View File
@@ -144,8 +144,15 @@ class Interpreter {
this.nodes[root].textContent = text;
}
SetAttribute(id, field, value, ns) {
const node = this.nodes[id];
this.SetAttributeInner(node, field, value, ns);
console.log("set attribute", id, field, value, ns);
if (value === null) {
this.RemoveAttribute(id, field, ns);
}
else {
const node = this.nodes[id];
this.SetAttributeInner(node, field, value, ns);
}
}
SetAttributeInner(node, field, value, ns) {
const name = field;
@@ -334,9 +341,6 @@ class Interpreter {
case "SetAttribute":
this.SetAttribute(edit.id, edit.name, edit.value, edit.ns);
break;
case "SetBoolAttribute":
this.SetAttribute(edit.id, edit.name, edit.value, edit.ns);
break;
case "RemoveAttribute":
this.RemoveAttribute(edit.id, edit.name, edit.ns);
break;