diff --git a/src/js/SpacedTextAccumulator.js b/src/js/SpacedTextAccumulator.js index c86bd406dea1d3fd3f4f8684722ad18d7a58bb37..d24ab68d2b5e628e0e689496f02d44be5259c0b5 100644 --- a/src/js/SpacedTextAccumulator.js +++ b/src/js/SpacedTextAccumulator.js @@ -1,8 +1,11 @@ -/** @template {HTMLElement|DocumentFragment} [ContainerT=DocumentFragment] */ +/** + * @typedef {HTMLElement|DocumentFragment} ContainerT + */ globalThis.SpacedTextAccumulator = class SpacedTextAccumulator { /** @param {ContainerT} [container] */ constructor(container) { - this._container = container || /** @type {ContainerT} */(new DocumentFragment()); + /** @type {ContainerT} */ + this._container = container || new DocumentFragment(); /** @type {(string|HTMLElement|DocumentFragment)[]} */ this._accumulator = []; this._checked = false; @@ -23,7 +26,6 @@ globalThis.SpacedTextAccumulator = class SpacedTextAccumulator { } } - /** get a reference the underlying container */ container() { this._checkScope(); return this._container; @@ -55,7 +57,7 @@ globalThis.SpacedTextAccumulator = class SpacedTextAccumulator { /** assemble an element from the accumulated sentences or sentence fragments, separated by spaces * @template {keyof HTMLElementTagNameMap} K * @param {K} element - * @param {string|Array<string>} [classNames] + * @param {Array<string>} [classNames] */ toNode(element, classNames) { const el = App.UI.DOM.makeElement(element, null, classNames);