Constructor
new Button(config)
Construct a button.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
module:hcje/domTools~ButtonConfig | Button configuration. |
- 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:
disabled :boolean
Disabled state.
Type:
- boolean
- Source:
(readonly) eventType :string
The event type used by this button.
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:
isOn() → {boolean}
Test if button is on. Always false if not a toggle button.
- Source:
Returns:
- Type
- boolean
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: