revojs 0.0.36 → 0.0.37

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -305,23 +305,24 @@ const hydrate = async (scope, parentNode, slot, index, previous) => {
305
305
  const textContent = slot.toString();
306
306
  if (isTextNode(hydration)) {
307
307
  if (previous) hydration.textContent = textContent;
308
- else if (hydration.textContent !== textContent) parentNode.insertBefore(hydration.splitText(textContent.length), hydration.nextSibling);
308
+ else if (textContent !== hydration.textContent) hydration = parentNode.replaceChild(document.createTextNode(textContent), hydration);
309
309
  } else hydration = document.createTextNode(textContent);
310
310
  }
311
311
  if (isTemplate(slot)) {
312
312
  const Component = components.get(slot.tag);
313
313
  if (Component) registerComponent(Component);
314
314
  if (isElementNode(hydration, slot.tag) === false) hydration = document.createElementNS(namespace(slot.tag), slot.tag);
315
- for (const [name, value] of Object.entries(slot.attributes)) createCompute(scope, (scope$1) => {
315
+ for (const [name, value] of Object.entries(slot.attributes)) createCompute(scope, (childScope) => {
316
316
  const target = hydration;
317
317
  if (name.startsWith("on")) {
318
318
  const event = name.substring(2).toLowerCase();
319
- useEvent(scope$1, target, event, value);
319
+ useEvent(childScope, target, event, value);
320
320
  } else {
321
321
  const set = toString(value);
322
322
  if (set === "" || set === "false") return target.removeAttribute(name);
323
323
  return target.setAttribute(name, set);
324
324
  }
325
+ scope.onStop(() => childScope.stop());
325
326
  });
326
327
  for (const [index$1, childSlot] of slot.children.entries()) await hydrate(scope, hydration, childSlot, index$1);
327
328
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",