whits
    Preparing search index...

    Class Tag<S, T>

    Represents an HTML tag with its attributes and children.

    Type Parameters

    Index

    Constructors

    • Creates a new instance of the Tag class.

      Type Parameters

      • S extends SelectorString

        The selector.

      • T extends
            | "symbol"
            | "object"
            | "search"
            | "big"
            | "blink"
            | "link"
            | "small"
            | "strike"
            | "sub"
            | "sup"
            | "map"
            | "filter"
            | "input"
            | "set"
            | "base"
            | "code"
            | "data"
            | "time"
            | "command"
            | "source"
            | "progress"
            | "discard"
            | "stop"
            | "track"
            | "button"
            | "address"
            | "unknown"
            | "center"
            | "view"
            | "animation"
            | "clipPath"
            | "content"
            | "cursor"
            | "font"
            | "marker"
            | "mask"
            | "a"
            | "abbr"
            | "area"
            | "article"
            | "aside"
            | "audio"
            | "b"
            | "bdi"
            | "bdo"
            | "blockquote"
            | "body"
            | "br"
            | "canvas"
            | "caption"
            | "cite"
            | "col"
            | "colgroup"
            | "datalist"
            | "dd"
            | "del"
            | "details"
            | "dfn"
            | "dialog"
            | "div"
            | "dl"
            | "dt"
            | "em"
            | "embed"
            | "fieldset"
            | "figcaption"
            | "figure"
            | "footer"
            | "form"
            | "h1"
            | "h2"
            | "h3"
            | "h4"
            | "h5"
            | "h6"
            | "head"
            | "header"
            | "hgroup"
            | "hr"
            | "html"
            | "i"
            | "iframe"
            | "img"
            | "ins"
            | "kbd"
            | "label"
            | "legend"
            | "li"
            | "main"
            | "mark"
            | "menu"
            | "meta"
            | "meter"
            | "nav"
            | "noscript"
            | "ol"
            | "optgroup"
            | "option"
            | "output"
            | "p"
            | "picture"
            | "pre"
            | "q"
            | "rp"
            | "rt"
            | "ruby"
            | "s"
            | "samp"
            | "script"
            | "section"
            | "select"
            | "slot"
            | "span"
            | "strong"
            | "style"
            | "summary"
            | "table"
            | "tbody"
            | "td"
            | "template"
            | "textarea"
            | "tfoot"
            | "th"
            | "thead"
            | "title"
            | "tr"
            | "u"
            | "ul"
            | "var"
            | "video"
            | "wbr"
            | "acronym"
            | "applet"
            | "basefont"
            | "bgsound"
            | "dir"
            | "frame"
            | "frameset"
            | "isindex"
            | "keygen"
            | "listing"
            | "marquee"
            | "menuitem"
            | "multicol"
            | "nextid"
            | "nobr"
            | "noembed"
            | "noframes"
            | "param"
            | "plaintext"
            | "rb"
            | "rtc"
            | "spacer"
            | "tt"
            | "xmp"
            | "animate"
            | "animateMotion"
            | "animateTransform"
            | "circle"
            | "defs"
            | "desc"
            | "ellipse"
            | "feBlend"
            | "feColorMatrix"
            | "feComponentTransfer"
            | "feComposite"
            | "feConvolveMatrix"
            | "feDiffuseLighting"
            | "feDisplacementMap"
            | "feDistantLight"
            | "feDropShadow"
            | "feFlood"
            | "feFuncA"
            | "feFuncB"
            | "feFuncG"
            | "feFuncR"
            | "feGaussianBlur"
            | "feImage"
            | "feMerge"
            | "feMergeNode"
            | "feMorphology"
            | "feOffset"
            | "fePointLight"
            | "feSpecularLighting"
            | "feSpotLight"
            | "feTile"
            | "feTurbulence"
            | "foreignObject"
            | "g"
            | "image"
            | "line"
            | "linearGradient"
            | "metadata"
            | "mpath"
            | "path"
            | "pattern"
            | "polygon"
            | "polyline"
            | "radialGradient"
            | "rect"
            | "svg"
            | "switch"
            | "text"
            | "textPath"
            | "tspan"
            | "use"
            | "math"
            | "element"
            | "rbc"
            | "shadow"
            | "altGlyph"
            | "altGlyphDef"
            | "altGlyphItem"
            | "animateColor"
            | "color-profile"
            | "font-face"
            | "font-face-format"
            | "font-face-name"
            | "font-face-src"
            | "font-face-uri"
            | "glyph"
            | "glyphRef"
            | "handler"
            | "hkern"
            | "listener"
            | "missing-glyph"
            | "prefetch"
            | "solidColor"
            | "tbreak"
            | "textArea"
            | "tref"
            | "vkern" = SelectorName<S>

        The tag name.

      Parameters

      • selectorString: S = ...

        The selector string of the tag.

      • attributes: AttributesArg<T> = {}

        The attributes of the tag.

      • Optionalchildren: ChildrenArg<T>

        An array of child elements of the tag.

      Returns Tag<S, T>

    Properties

    attributes: Partial<Attributes<T>> = {}

    The attributes of the tag.

    children: T extends | "link"
    | "input"
    | "base"
    | "command"
    | "source"
    | "track"
    | "area"
    | "br"
    | "col"
    | "embed"
    | "hr"
    | "img"
    | "meta"
    | "wbr"
    | "keygen"
    | "param"
        ? []
        : TagContent<T>

    An array of child elements of the tag.

    isVoid: T extends | "link"
    | "input"
    | "base"
    | "command"
    | "source"
    | "track"
    | "area"
    | "br"
    | "col"
    | "embed"
    | "hr"
    | "img"
    | "meta"
    | "wbr"
    | "keygen"
    | "param"
        ? true
        : false

    Whether the tag is a void tag or not.

    outerContent: Record<"before" | "after", null | string | RawContent> = ...

    Optional content to insert before and/or after the tag.

    selector: Selector<S, T>

    The selector of the tag.

    style: TagStyle = ...

    The style of the tag.

    keepWhitespace: Set<
        | "symbol"
        | "object"
        | "search"
        | "big"
        | "blink"
        | "link"
        | "small"
        | "strike"
        | "sub"
        | "sup"
        | "map"
        | "filter"
        | "input"
        | "set"
        | "base"
        | "code"
        | "data"
        | "time"
        | "command"
        | "source"
        | "progress"
        | "discard"
        | "stop"
        | "track"
        | "button"
        | "address"
        | "unknown"
        | "center"
        | "view"
        | "animation"
        | "clipPath"
        | "content"
        | "cursor"
        | "font"
        | "marker"
        | "mask"
        | "a"
        | "abbr"
        | "area"
        | "article"
        | "aside"
        | "audio"
        | "b"
        | "bdi"
        | "bdo"
        | "blockquote"
        | "body"
        | "br"
        | "canvas"
        | "caption"
        | "cite"
        | "col"
        | "colgroup"
        | "datalist"
        | "dd"
        | "del"
        | "details"
        | "dfn"
        | "dialog"
        | "div"
        | "dl"
        | "dt"
        | "em"
        | "embed"
        | "fieldset"
        | "figcaption"
        | "figure"
        | "footer"
        | "form"
        | "h1"
        | "h2"
        | "h3"
        | "h4"
        | "h5"
        | "h6"
        | "head"
        | "header"
        | "hgroup"
        | "hr"
        | "html"
        | "i"
        | "iframe"
        | "img"
        | "ins"
        | "kbd"
        | "label"
        | "legend"
        | "li"
        | "main"
        | "mark"
        | "menu"
        | "meta"
        | "meter"
        | "nav"
        | "noscript"
        | "ol"
        | "optgroup"
        | "option"
        | "output"
        | "p"
        | "picture"
        | "pre"
        | "q"
        | "rp"
        | "rt"
        | "ruby"
        | "s"
        | "samp"
        | "script"
        | "section"
        | "select"
        | "slot"
        | "span"
        | "strong"
        | "style"
        | "summary"
        | "table"
        | "tbody"
        | "td"
        | "template"
        | "textarea"
        | "tfoot"
        | "th"
        | "thead"
        | "title"
        | "tr"
        | "u"
        | "ul"
        | "var"
        | "video"
        | "wbr"
        | "acronym"
        | "applet"
        | "basefont"
        | "bgsound"
        | "dir"
        | "frame"
        | "frameset"
        | "isindex"
        | "keygen"
        | "listing"
        | "marquee"
        | "menuitem"
        | "multicol"
        | "nextid"
        | "nobr"
        | "noembed"
        | "noframes"
        | "param"
        | "plaintext"
        | "rb"
        | "rtc"
        | "spacer"
        | "tt"
        | "xmp"
        | "animate"
        | "animateMotion"
        | "animateTransform"
        | "circle"
        | "defs"
        | "desc"
        | "ellipse"
        | "feBlend"
        | "feColorMatrix"
        | "feComponentTransfer"
        | "feComposite"
        | "feConvolveMatrix"
        | "feDiffuseLighting"
        | "feDisplacementMap"
        | "feDistantLight"
        | "feDropShadow"
        | "feFlood"
        | "feFuncA"
        | "feFuncB"
        | "feFuncG"
        | "feFuncR"
        | "feGaussianBlur"
        | "feImage"
        | "feMerge"
        | "feMergeNode"
        | "feMorphology"
        | "feOffset"
        | "fePointLight"
        | "feSpecularLighting"
        | "feSpotLight"
        | "feTile"
        | "feTurbulence"
        | "foreignObject"
        | "g"
        | "image"
        | "line"
        | "linearGradient"
        | "metadata"
        | "mpath"
        | "path"
        | "pattern"
        | "polygon"
        | "polyline"
        | "radialGradient"
        | "rect"
        | "svg"
        | "switch"
        | "text"
        | "textPath"
        | "tspan"
        | "use"
        | "math"
        | "element"
        | "rbc"
        | "shadow"
        | "altGlyph"
        | "altGlyphDef"
        | "altGlyphItem"
        | "animateColor"
        | "color-profile"
        | "font-face"
        | "font-face-format"
        | "font-face-name"
        | "font-face-src"
        | "font-face-uri"
        | "glyph"
        | "glyphRef"
        | "handler"
        | "hkern"
        | "listener"
        | "missing-glyph"
        | "prefetch"
        | "solidColor"
        | "tbreak"
        | "textArea"
        | "tref"
        | "vkern",
    > = ...

    The list of tags that are immune from whitespace truncation

    Accessors

    • get html(): string

      Returns the HTML string representation of the tag.

      Returns string

      The HTML string representation of the tag.

    • get htmlAttributes(): string

      Returns the HTML attributes string of the tag.

      Returns string

      The HTML attributes string of the tag.

    • get htmlChildren(): string

      Returns the HTML string representation of the child elements of the tag.

      Returns string

      The HTML string representation of the child elements of the tag.

    • get tag(): T

      Returns the tag name.

      Returns T

      The tag name.

    Methods

    • Clones the tag.

      Parameters

      • deep: boolean = false

        Whether to clone the children of the tag or not.

      Returns Tag<S, T>

      A new instance of the Tag class.

    • Returns the HTML string representation of the tag.

      Returns string

      The HTML string representation of the tag.