Constructor
new DomTextSpriteRenderer(container, txt, optionsopt)
Construct renderer.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
container |
Element | module:hcje/domTools.ElementWrapper | DOM element that holds the sprite. The sprite element is automatically appended to the container. |
|||||||
txt |
string | The text content for the sprite. |
|||||||
options |
Object |
<optional> |
Properties
|
- Implements:
- 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
- Overrides:
- 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:
kill()
Function that is called by the sprite to indicate that the sprite is being killed and all resources should be released.
- Implements:
- 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:
render(sprite)
Render the sprite.
Parameters:
| Name | Type | Description |
|---|---|---|
sprite |
module:hcje/sprites.Sprite | The sprite to render. |
- Implements:
- 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. |
- Overrides:
- Source: