Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Class StringNode

    A class that behaves like a lightweight DOM node, allowing children to be appended. Serializes to an HTML string.

    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Parameters

      • Optionaltag: string

        The tag name. If none is provided, this node's children will not be wrapped in an outer tag.

      • Optionalattrs: Record<string, string> = {}

        The tag attributes.

      • Optionalinline: boolean = true

        Whether the node appears inline or as a block.

      Returns StringNode

    Accessors

    • get inline(): boolean

      Whether the node appears inline or as a block.

      Returns boolean

    Methods

    • Append a child to this string node.

      Parameters

      • child: string | StringNode

        The child node or string.

      Returns void

      If attempting to append a child to a void element.

    • Serialize the StringNode structure into a single string.

      Parameters

      • spaces: string | number = 0

        The number of spaces to use for indentation (maximum 10). If this value is a string, that string is used as indentation instead (or the first 10 characters if it is longer).

      • Optionalinternal: { _depth?: number; _inlineParent?: boolean } = {}

      Returns any

    • Convert an HTML string to a StringNode.

      Parameters

      • html: string

        The HTML string.

      Returns StringNode

      If unable to perform conversion.