* Restore current element from a replacement element
()
| 308 | * Restore current element from a replacement element |
| 309 | */ |
| 310 | restoreEl() { |
| 311 | if (this.$el.isConnected || !this.$replacement.isConnected) return; |
| 312 | if (typeof this.onRestore === "function") this.onRestore(); |
| 313 | this.$el.off("hide", this.onhide); |
| 314 | this.$replacement.parentElement.replaceChild(this.$el, this.$replacement); |
| 315 | const { scrollLeft, scrollTop } = this; |
| 316 | requestAnimationFrame(() => { |
| 317 | const $body = this.$el.body; |
| 318 | if ($body) { |
| 319 | $body.scrollLeft = scrollLeft; |
| 320 | $body.scrollTop = scrollTop; |
| 321 | } |
| 322 | }); |
| 323 | this.$el.on("hide", this.onhide); |
| 324 | } |
| 325 | |
| 326 | onhide() { |
| 327 | this.$el.off("hide", this.onhide); |