ctrl-fx 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1087,22 +1087,22 @@ function updateText(node, newText) {
1087
1087
  node.realNode.nodeValue = newText;
1088
1088
  }
1089
1089
  function updateAttrs(node, newAttrs) {
1090
+ const oldAttrsMap = new Map(node.attrs.map((a) => [a.name, a]));
1090
1091
  const newAttrsMap = new Map(newAttrs.map((a) => [a.name, a]));
1091
1092
  node.attrs.forEach((oldAttr) => {
1092
- const newAttr = newAttrsMap.get(oldAttr.name);
1093
- if (newAttr) {
1094
- if (newAttr.value || oldAttr.value) {
1095
- if (newAttr.value !== oldAttr.value) {
1096
- node.realNode.setAttribute(
1097
- newAttr.name,
1098
- newAttr.value ? newAttr.value : ""
1099
- );
1100
- }
1101
- }
1102
- } else {
1093
+ if (!newAttrsMap.has(oldAttr.name)) {
1103
1094
  node.realNode.removeAttribute(oldAttr.name);
1104
1095
  }
1105
1096
  });
1097
+ newAttrs.forEach((newAttr) => {
1098
+ const oldAttr = oldAttrsMap.get(newAttr.name);
1099
+ if (!oldAttr || newAttr.value !== oldAttr.value) {
1100
+ node.realNode.setAttribute(
1101
+ newAttr.name,
1102
+ newAttr.value ? newAttr.value : ""
1103
+ );
1104
+ }
1105
+ });
1106
1106
  node.attrs = newAttrs;
1107
1107
  }
1108
1108
  function updateProps(node, newProps) {
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  permission,
5
5
  toComponent,
6
6
  uuidFromString
7
- } from "./chunk-BDTTV33M.js";
7
+ } from "./chunk-PHE3QHCS.js";
8
8
  import "./chunk-EKBLRHWK.js";
9
9
  import "./chunk-OSIRHKDB.js";
10
10
  import "./chunk-XICUXW4T.js";
package/dist/testing.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  testApplication,
16
16
  testComponent,
17
17
  textInput
18
- } from "./chunk-BDTTV33M.js";
18
+ } from "./chunk-PHE3QHCS.js";
19
19
  import "./chunk-EKBLRHWK.js";
20
20
  import {
21
21
  ResponseBody,
@@ -2,7 +2,7 @@ import {
2
2
  ComponentManager,
3
3
  domInterpreter,
4
4
  realStyleRegistry
5
- } from "./chunk-BDTTV33M.js";
5
+ } from "./chunk-PHE3QHCS.js";
6
6
  import "./chunk-EKBLRHWK.js";
7
7
  import "./chunk-OSIRHKDB.js";
8
8
  import "./chunk-XICUXW4T.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctrl-fx",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A no-dependency, purely functional TypeScript framework for building web applications",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",