@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.
- package/package.json +1 -1
- package/src/core/Domo.js +8 -8
package/package.json
CHANGED
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
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
if (
|
|
333
|
-
this.element.replaceWith(
|
|
334
|
-
this.element =
|
|
335
|
-
} else if (this.element.contains(
|
|
336
|
-
|
|
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;
|