Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EmptyElement

The EmptyElement class represents elements that do not have a closing tag.

Hierarchy

Constructors

constructor

  • Constructs an element

    Parameters

    • tag: string

      The tag name of the element.

    • Optional tier1: string | Attributes

      Either a string representing the identifier string or a list of attributes.

    • Optional tier2: Attributes

      A list of attributes, accepted ONLY IF tier1 is not an attribute.

    Returns EmptyElement

Properties

Protected templates

templates: SimpleObject

Accessors

r

  • get r(): string
  • Getting for the HTML returned by the render function.

    Returns string

Methods

append

  • Appends templates to the existing templates object.

    Parameters

    • templates: SimpleObject

      Key-value pairs that map to a template rendered in StringLiteral's

    • Default value prioritize: boolean = false

      Whether or not to allow appended templates to override existing template properties

    Returns Renderable

getAttributes

getClassList

  • getClassList(): Array<string>
  • Get element class list

    Returns Array<string>

Protected getHtmlAttributeList

  • getHtmlAttributeList(): string
  • Given an object of attributes, converts attributes into the HTML equivalent list.

    Returns string

getId

  • getId(): string | null
  • Get element id

    Returns string | null

getTag

  • getTag(): string
  • Get element tag

    Returns string

Protected internalRender

render

  • Renders the internalRender function.

    Parameters

    Returns string

setAttribute

  • Sets an attribute of the element

    Parameters

    • name: string

      Name of the attribute.

    • value: Attribute

      The attribute value. Alternatively accepts an array with the form: [condition, string1, string2?] which will use string1 if condition == trye. Otherwise it will use string2 if it exists. If string2 is not defined and condition == false, then the attribute will be omitted.

    Returns Element

setAttributes

setClassList

  • setClassList(classes: Array<string>): Element
  • Sets the elements class list.

    Parameters

    • classes: Array<string>

      The new set of classes that the element will get.

    Returns Element

setId

  • Set the ID.

    Parameters

    • id: string

      The new id.

    Returns Element

Protected setIdentifierString

  • setIdentifierString(identifier: string): void
  • Set's the id and classes of the element given an identifier string.

    Parameters

    • identifier: string

      An identifier string. See isIdentifierString for more information.

    Returns void

setIdentifiers

  • setIdentifiers(identifier: string): Element
  • Set the identifiers.

    Parameters

    • identifier: string

      An identifier string. See isIdentifierString for more information.

    Returns Element

toString

  • toString(): string
  • Overrides the toString method called by JavaScript when string concatenate occurs

    Returns string

when

  • Turn on and off the ability for this element to render

    Parameters

    • condition: boolean

      The condition that determines whether or not the element can render.

    Returns Renderable

with

  • Sets the templates.

    Parameters

    • templates: SimpleObject

      Key-value pairs that map to a template rendered in StringLiteral's

    Returns Renderable

Static Protected isIdentifierString

  • isIdentifierString(tester: string): boolean
  • Determines if a string is an identifier string. An identifier string either starts with "#" or "." and specifies a list of identifiers for an element. An example is "#book.col.col-xs-5". There can only be a single id and it must be specified at the beginning. For example: ".col.col-xs-5#book" is not a valid identifier string.

    Parameters

    • tester: string

    Returns boolean

Generated using TypeDoc