* Replace current element with a replacement element
()
| 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 |