Class: TextElement

hcje/domTools.TextElement()

Simple text element wrapper which supports Markdown.

Constructor

new TextElement()

Construct the TextElement class.

Source:

Extends

Members

(protected, readonly) _element :Element

The wrapped element. This is protected and is only intended for use by the domTools module.

Type:
  • Element
Overrides:
Source:

(readonly) classList :DOMTokenList

The classList.

Type:
  • DOMTokenList
Overrides:
Source:
See:

className :string

The class name.

Type:
  • string
Overrides:
Source:
See:

innerText :string

The innerText property of the underlying element.

Type:
  • string
Source:

(readonly) offsetHeight :number

Element's offset height.

Type:
  • number
Overrides:
Source:

(readonly) offsetWidth :number

Element's offset width.

Type:
  • number
Overrides:
Source:

(readonly) parentElement :string

The parent element.

Type:
  • string
Overrides:
Source:
See:

(readonly) style :CSSStyleProperties

Element's style.

Type:
  • CSSStyleProperties
Overrides:
Source:
See:

Methods

addEventListener(eventType, listener, optionsOrUseCapture)

Add event listener.

Parameters:
Name Type Description
eventType string

Event type to listen to

listener function | Object

Handler of the event

optionsOrUseCapture Object | boolean

Additional options

Overrides:
Source:
See:

appendChild(child)

Append child.

Parameters:
Name Type Description
child Element | ElementWrapper

Element to append

Overrides:
Source:
See:

appendTo(parentElement)

Append to a parent element. Note, if it is already a child, this call is ignored. This method is provided to allow callers to adust hierarchies without needing access to the protected wrapped element. Note that the method will silently return if parentElement is not provided.

Parameters:
Name Type Description
parentElement module:hcje/domTools~ElementWrapper | HTMLElement

The element to which the wrapped element should be appended.

Overrides:
Source:

blur()

Remove the element's focus.

Overrides:
Source:

focus()

Give the element focus.

Overrides:
Source:

remove()

Remove the element from the DOM. The instance wrapping the element still exists if a reference to it is maintained.

Overrides:
Source:

removeAllChildren()

Remove all children.

Overrides:
Source:

setMarkdown(markdown)

Set markdown. This converts the text from Markdown to HTML and then updates the innerHtml of the underlying element.

Parameters:
Name Type Description
markdown string

The text to format and write.

Source: