@zyrab/domo 1.1.0 → 1.1.1

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/package.json +1 -1
  2. package/src/core/Domo.js +8 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyrab/domo",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Minimalist DOM builder and chaining-friendly micro-framework with router support.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/core/Domo.js CHANGED
@@ -326,14 +326,14 @@ class Domo {
326
326
  * @param {(Node|string|number|Domo|DocumentFragment|Array<any>)[]} newChild
327
327
  */
328
328
  replace(child, newChild) {
329
- const newChild = this._handleElementInstance(newChild);
330
- const child = this._handleElementInstance(child);
331
-
332
- if (child === this.element) {
333
- this.element.replaceWith(newChild);
334
- this.element = newChild;
335
- } else if (this.element.contains(child)) {
336
- child.replaceWith(newChild);
329
+ const resolvedNew = this._handleElementInstance(newChild);
330
+ const resolvedOld = this._handleElementInstance(child);
331
+
332
+ if (resolvedOld === this.element) {
333
+ this.element.replaceWith(resolvedNew);
334
+ this.element = resolvedNew;
335
+ } else if (this.element.contains(resolvedOld)) {
336
+ resolvedOld.replaceWith(resolvedNew);
337
337
  }
338
338
 
339
339
  return this;