DomElementBuilder class

Index

Constructors

Protected Properties

Public Methods

Constructors


constructor

⊕ new DomElementBuilder(tag: string | TElement,parent?: HTMLElement): DomElementBuilder

Parameters:

  • tag: string | TElement
  • parent: HTMLElement, Optional

Protected Properties


element

● element: TElement


Public Methods


addChild

▸ addChild(tag: "div",childBuilder?: (builder: DomElementBuilder<HTMLDivElement>) => void): this

Parameters:

  • tag: "div"
  • childBuilder: (builder: DomElementBuilder<HTMLDivElement>) => void, Optional

Returns this ▸ addChild(tag: "button",childBuilder?: (builder: DomElementBuilder<HTMLButtonElement>) => void): this

Parameters:

  • tag: "button"
  • childBuilder: (builder: DomElementBuilder<HTMLButtonElement>) => void, Optional

Returns this ▸ addChild(tag: "a",childBuilder?: (builder: DomElementBuilder<HTMLAnchorElement>) => void): this

Parameters:

  • tag: "a"
  • childBuilder: (builder: DomElementBuilder<HTMLAnchorElement>) => void, Optional

Returns this ▸ addChild(tag: "img",childBuilder?: (builder: DomElementBuilder<HTMLImageElement>) => void): this

Parameters:

  • tag: "img"
  • childBuilder: (builder: DomElementBuilder<HTMLImageElement>) => void, Optional

Returns this ▸ addChild(tag: "input",childBuilder?: (builder: DomInputElementBuilder) => void): this

Parameters:

Returns this ▸ addChild(tag: "dropdown",childBuilder?: (builder: DomDropDownElementBuilder) => void): this

Parameters:

Returns this ▸ addChild(tag: string,childBuilder?: (builder: DomElementBuilder<HTMLElement>) => void): this

Parameters:

  • tag: string
  • childBuilder: (builder: DomElementBuilder<HTMLElement>) => void, Optional

Returns this


addChildElement

▸ addChildElement(element: HTMLElement): this

Parameters:

  • element: HTMLElement

Returns this


addClass

▸ addClass(className: string,classNames: string[]): this

Parameters:

  • className: string
  • classNames: string[]

Returns this


addHtml

▸ addHtml(html: string): this

Parameters:

  • html: string

Returns this


addText

▸ addText(text: string): this

Parameters:

  • text: string

Returns this


appendTo

▸ appendTo(parent: HTMLElement): this

Parameters:

  • parent: HTMLElement

Returns this


attr

▸ attr(attrId: string,attrValue: string): this

Parameters:

  • attrId: string
  • attrValue: string

Returns this


clear

▸ clear(): void

Returns void


data

▸ data(dataId: string,dataValue?: string): this

Parameters:

  • dataId: string
  • dataValue: string, Default value = null

Returns this


hide

▸ hide(toHide?: boolean): this

Parameters:

  • toHide: boolean, Default value = true

Returns this


html

▸ html(html: string): this

Parameters:

  • html: string

Returns this


id

▸ id(value: string): this

Parameters:

  • value: string

Returns this


isVisible

▸ isVisible(): boolean

Returns boolean


off

▸ off(eventType: string,listener: (event: Event, options?: boolean | AddEventListenerOptions) => any): this

Parameters:

  • eventType: string
  • listener: (event: Event, options?: boolean | AddEventListenerOptions) => any

Returns this


on

▸ on(eventType: string,listener: (event: Event, options?: boolean | AddEventListenerOptions) => any): this

Parameters:

  • eventType: string
  • listener: (event: Event, options?: boolean | AddEventListenerOptions) => any

Returns this


removeClass

▸ removeClass(className: string,classNames: string[]): this

Parameters:

  • className: string
  • classNames: string[]

Returns this


removeStyle

▸ removeStyle(styleId: string): this

Parameters:

  • styleId: string

Returns this


setStyle

▸ setStyle(styleId: string,styleValue: string): this

Parameters:

  • styleId: string
  • styleValue: string

Returns this


show

▸ show(): this

Returns this


text

▸ text(text: string): this

Parameters:

  • text: string

Returns this


title

▸ title(value: string): this

Parameters:

  • value: string

Returns this


toDOM

▸ toDOM(): TElement

Returns TElement


toggleClass

▸ toggleClass(className: string,force?: boolean): this

Parameters:

  • className: string
  • force: boolean, Default value = undefined

Returns this