# new Validatable()
Generic instance all Validatable instances inherit from. Defines default shared logic and interfaces.
Extends
Classes
Methods
# addEventListener(event_name, callback)
Add an event listener
Parameters:
Name | Type | Description |
---|---|---|
event_name |
string | Name of the event |
callback |
EventCallback | Event callback to fire |
# addMessage(message, statusopt)
Adds a unique message to the $MessageNode
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
The message to append |
||
status |
<optional> |
An optional class to append indicating message status |
If the $MessageNode isn't set or isn't an HTMLElement
# addMessages(messages, statusopt)
Batch append messages
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
messages |
The messages to append |
||
status |
<optional> |
An optional class to append indicating message status |
If the $MessageNode isn't set or isn't an HTMLElement
# clearMessages()
Clear all messages from the $MessageNode (If set)
# createEvent(event_name, options) → {Event}
Helper for creating a new event, supporting IE9
Parameters:
Name | Type | Description |
---|---|---|
event_name |
string | Name of the event |
options |
EventOptions | Event options |
# dispatchEvent(event, data) → {boolean}
Include support for passing data along event
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the Event object to dispatch |
data |
any | Data to be passed to the callback |
# generateMessageNode(anchoropt, posopt)
Generate a messageNode where messages can be added and removed in a managed way.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
anchor |
<optional> |
The anchor to use for the $MessageNode (Defaults to $MessageAnchor) |
|
pos |
<optional> |
The position to set $MessageNode inside the $MessageAnchor |
If anchor isn't an Element
If pos isn't a valid
# isElementVisible(element)
Helper method to determine if the element is visible within the DOM
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | Element to test |
boolean
# removeEventListener(event_name, callback) → {EventCallback|null}
Remove an event listener
Parameters:
Name | Type | Description |
---|---|---|
event_name |
string | Name of the event |
callback |
EventCallback | The event callback to remove |
# removeMessage(message)
Remove a message
Parameters:
Name | Type | Description |
---|---|---|
message |
The message to remove |
If the $MessageNode isn't set or isn't an HTMLElement
# removeMessageNode()
Removes the $MessageNode from the $MessageAnchor
If the $MessageNode isn't set or isn't an HTMLElement