diff --git a/src/core/drive/morph_renderer.js b/src/core/drive/morph_renderer.js index 8f8181464..e9a647779 100644 --- a/src/core/drive/morph_renderer.js +++ b/src/core/drive/morph_renderer.js @@ -3,6 +3,9 @@ import { dispatch, nextAnimationFrame } from "../../util" import { Renderer } from "../renderer" export class MorphRenderer extends Renderer { + static renderElement(currentElement, newElement) { + } + async render() { if (this.willRender) await this.#morphBody() } diff --git a/src/core/drive/page_view.js b/src/core/drive/page_view.js index 6cf25dfd5..bff0815f0 100644 --- a/src/core/drive/page_view.js +++ b/src/core/drive/page_view.js @@ -19,7 +19,7 @@ export class PageView extends View { const shouldMorphPage = this.isPageRefresh(visit) && this.snapshot.shouldMorphPage const rendererClass = shouldMorphPage ? MorphRenderer : PageRenderer - const renderer = new rendererClass(this.snapshot, snapshot, PageRenderer.renderElement, isPreview, willRender) + const renderer = new rendererClass(this.snapshot, snapshot, isPreview, willRender) if (!renderer.shouldRender) { this.forceReloaded = true @@ -32,7 +32,7 @@ export class PageView extends View { renderError(snapshot, visit) { visit?.changeHistory() - const renderer = new ErrorRenderer(this.snapshot, snapshot, ErrorRenderer.renderElement, false) + const renderer = new ErrorRenderer(this.snapshot, snapshot, false) return this.render(renderer) } diff --git a/src/core/frames/frame_controller.js b/src/core/frames/frame_controller.js index 5940ba761..4a85196d8 100644 --- a/src/core/frames/frame_controller.js +++ b/src/core/frames/frame_controller.js @@ -307,7 +307,7 @@ export class FrameController { if (newFrameElement) { const snapshot = new Snapshot(newFrameElement) - const renderer = new FrameRenderer(this, this.view.snapshot, snapshot, FrameRenderer.renderElement, false, false) + const renderer = new FrameRenderer(this, this.view.snapshot, snapshot, false, false) if (this.view.renderPromise) await this.view.renderPromise this.changeHistory() diff --git a/src/core/renderer.js b/src/core/renderer.js index 56e73983e..414335b88 100644 --- a/src/core/renderer.js +++ b/src/core/renderer.js @@ -3,12 +3,16 @@ import { Bardo } from "./bardo" export class Renderer { #activeElement = null - constructor(currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) { + static renderElement(currentElement, newElement) { + // Abstract method + } + + constructor(currentSnapshot, newSnapshot, isPreview, willRender = true) { this.currentSnapshot = currentSnapshot this.newSnapshot = newSnapshot this.isPreview = isPreview this.willRender = willRender - this.renderElement = renderElement + this.renderElement = this.constructor.renderElement this.promise = new Promise((resolve, reject) => (this.resolvingFunctions = { resolve, reject })) }