MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / replaceEl

Method replaceEl

src/components/WebComponents/wcPage.js:298–305  ·  view source on GitHub ↗

* Replace current element with a replacement element

()

Source from the content-addressed store, hash-verified

296 * Replace current element with a replacement element
297 */
298 replaceEl() {
299 if (this.$el.classList.contains("primary")) return;
300 this.$el.off("hide", this.onhide);
301 if (!this.$el.isConnected || this.$replacement.isConnected) return;
302 if (typeof this.onReplace === "function") this.onReplace();
303 this.$el.parentElement.replaceChild(this.$replacement, this.$el);
304 this.$el.classList.add("no-transition");
305 }
306
307 /**
308 * Restore current element from a replacement element

Callers 1

wcPage.jsFile · 0.80

Calls 2

offMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected