new El(type, attrs, children)
El class constructor.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
String | Type of element to create. |
attrs |
Object | Attributes to set. |
children |
Array | Child elements to nest. |
- Source:
Members
-
<static> Extender :Object
-
Type:
- Object
- Source:
-
_animationSpeed
-
Set default animation speed
- Source:
-
_attributes :Object
-
Type:
- Object
- Source:
-
children :Array
-
Type:
- Array
- Source:
-
element :Object
-
Type:
- Object
- Source:
-
events :Array
-
Type:
- Array
- Source:
-
extenders :Array
-
Type:
- Array
- Source:
-
type :String
-
Type:
- String
- Source:
Methods
-
<static> addExtenders(extenders)
-
Add custom extenders
Parameters:
Name Type Description extendersArray.<Object> Array of extender configurations
Properties
Name Type Description nameString Name of custom extender
actionfunction Action of the custom extender
- Source:
-
<static> isArray(item)
-
Simple array check.
Parameters:
Name Type Description itemItem to check.
- Source:
Returns:
Is array.
- Type
- Boolean
-
<static> isBoolean(item)
-
Simple boolean check.
Parameters:
Name Type Description itemItem to check.
- Source:
Returns:
Is boolean.
- Type
- Boolean
-
<static> isDate(item)
-
Simple date check.
Parameters:
Name Type Description itemItem to check.
- Source:
Returns:
Is date.
- Type
- Boolean
-
<static> isFunction(item)
-
Simple function check.
Parameters:
Name Type Description itemItem to check.
- Source:
Returns:
Is function.
- Type
- Boolean
-
<static> isNumber(item)
-
Simple number check.
Parameters:
Name Type Description itemItem to check.
- Source:
Returns:
Is number.
- Type
- Boolean
-
<static> isObject(item)
-
Simple object check. Arrays not included.
Parameters:
Name Type Description itemItem to check.
- Source:
Returns:
Is object.
- Type
- Boolean
-
<static> isString(item)
-
Simple string check.
Parameters:
Name Type Description itemItem to check.
- Source:
Returns:
Is string.
- Type
- Boolean
-
<static> isTruthy(item)
-
Simple truthy check - only used for setting attribute values. Eliminates null, undefined and Infinity. Zero's are considered truthy (useful for setting attributes), as well as empty strings (used for setting blank attributes) and false (again, for setting attributes).
Parameters:
Name Type Description itemItem to check.
- Source:
Returns:
Is truthy.
- Type
- Boolean
-
<static> setAnimationSpeed(animationSpeed)
-
Set default animation speed
Parameters:
Name Type Description animationSpeedNumber Default animation speed
- Source:
-
<static> toQueryString(obj)
-
Convert an object to a query string.
Parameters:
Name Type Description objObject JS object to encode.
- Source:
Returns:
URL encoded query string.
- Type
- String
-
_prepend()
-
Prepend without pushing to children array
- Source:
-
addClass(myClass)
-
Adds a class or classes to an element.
Parameters:
Name Type Description myClassString | Array ClassName(s) to add. Can be a space-separated string or an array.
- Source:
Returns:
El class instance.
- Type
- Object
-
after(el)
-
Insert an element after another.
Parameters:
Name Type Description elObject El class instance.
- Source:
Returns:
El class instance.
- Type
- Object
-
appear()
-
Show an element with visibility: visible.
- Source:
Returns:
El class instance.
- Type
- Object
-
appearFor( [interval])
-
Show an element with appear() for x number of milliseconds.
Parameters:
Name Type Argument Default Description intervalNumber <optional>
200 Interval in milliseconds.
- Source:
Returns:
El class instance.
- Type
- Object
-
append(el)
-
Append an element or text node.
Parameters:
Name Type Description elObject | String Element to append or string to become text node to append.
- Source:
Returns:
El class instance.
- Type
- Object
-
appendHTML(html)
-
Append HTML
Parameters:
Name Type Description htmlString HTML to append.
- Source:
Returns:
El class instance.
- Type
- Object
-
appendText(text)
-
Append text content to an element.
Parameters:
Name Type Description textString Text to append.
- Source:
Returns:
El class instance.
- Type
- Object
-
blur()
-
Blur element (just a wrapper for the .blur DOM method).
- Source:
Returns:
El class instance.
- Type
- Object
-
click()
-
Simulate an element click (just a wrapper for the .click DOM method).
- Source:
Returns:
El class instance.
- Type
- Object
-
disable( [shouldDisable])
-
Disable an element by attribute and class.
Parameters:
Name Type Argument Default Description shouldDisableBoolean <optional>
true Conditionally disable.
- Source:
Returns:
El class instance.
- Type
- Object
-
disappear()
-
Hide an element with visibility: hidden.
- Source:
Returns:
El class instance.
- Type
- Object
-
disappearFor( [interval])
-
Hide an element with disappear() for x number of milliseconds.
Parameters:
Name Type Argument Default Description intervalNumber <optional>
200 Interval in milliseconds.
- Source:
Returns:
El class instance.
- Type
- Object
-
empty()
-
Empty an element's html content.
- Source:
Returns:
El class instance.
- Type
- Object
-
enable( [shouldEnable])
-
Enable an element by attribute and class.
Parameters:
Name Type Argument Default Description shouldEnableBoolean <optional>
true Conditionally enable.
- Source:
Returns:
El class instance.
- Type
- Object
-
encode()
-
Convert field value to URL encoded query string.
- Source:
Returns:
URL encoded query string.
- Type
- String
-
fadeIn( [interval] [, display])
-
Fade in element.
Parameters:
Name Type Argument Default Description intervalNumber <optional>
200 Transition interval (in milliseconds).
displayString <optional>
block CSS display property to set after element is faded in. Is only necessary if the CSS display property is set to 'none'.
- Source:
-
fadeInFor( [speed] [, interval])
-
Show an element with fadeIn() for x number of milliseconds.
Parameters:
Name Type Argument Default Description speedNumber <optional>
2000 Interval in milliseconds (shown interval).
intervalNumber <optional>
200 Interval in milliseconds (animation speed).
- Source:
Returns:
El class instance.
- Type
- Object
-
fadeOut( [interval] [, hide])
-
Fade out element.
Parameters:
Name Type Argument Default Description intervalNumber <optional>
200 Transition interval (in milliseconds).
hideBoolean <optional>
true Set to false to prevent element from being hidden after the animation.
- Source:
-
fadeOutFor( [speed] [, interval])
-
Hide an element with fadeOut() for x number of milliseconds.
Parameters:
Name Type Argument Default Description speedNumber <optional>
2000 Interval in milliseconds (hidden interval).
intervalNumber <optional>
200 Interval in milliseconds (animation speed).
- Source:
Returns:
El class instance.
- Type
- Object
-
focus()
-
Set focus on element.
- Source:
Returns:
El class instance.
- Type
- Object
-
get($key)
-
Retrieve a child element.
Parameters:
Name Type Default Description $keyString null Child identifying $key.
- Source:
Returns:
El class instance.
- Type
- Object
-
getAttribute(attr)
-
Gets an attribute.
Parameters:
Name Type Description attrString Attribute name to get.
- Source:
Returns:
Attribute value.
- Type
- String
-
getClassList()
-
Gets the list of classes applied to the element.
- Source:
Returns:
DOMTokenList or array of classes (depending on ClassList support).
- Type
- Object | Array
-
getHTML()
-
Gets the html content.
- Source:
Returns:
Html content.
- Type
- String
-
getText()
-
Gets the text content.
- Source:
Returns:
Text content.
- Type
- String
-
getValue()
-
Gets the value.
- Source:
Returns:
Element value.
- Type
- String
-
hasAttribute(attrToCheck)
-
Check for existence of an attribute.
Parameters:
Name Type Description attrToCheckString Attribute to check.
- Source:
Returns:
Has attribute.
- Type
- Booolean
-
hasClass(classToCheck)
-
Check for class existence.
Parameters:
Name Type Description classToCheckString Classname to check.
- Source:
Returns:
Class exists.
- Type
- Boolean
-
hasValue()
-
Check if an element has a value.
- Source:
Returns:
Element has value.
- Type
- Boolean
-
hide()
-
Hide element with display rule.
- Source:
Returns:
El class instance.
- Type
- Object
-
hideFor( [speed])
-
Call hide method, then show after x amount of ms.
Parameters:
Name Type Argument Default Description speedNumber <optional>
200 Interval to hide.
- Source:
Returns:
El class instance.
- Type
- Object
-
next()
-
Return the next sibling element
- Source:
Returns:
node
- Type
- Object
-
off(eventName, handler [, options] [, options])
-
Detach event handler. If only the eventName parameter is given, all events of that event type will be detached. If no arguments are given, all events will be detached.
Parameters:
Name Type Argument Default Description eventNameString Name of event.
handlerfunction Function reference.
optionsObject <optional>
Event options.
Properties
Name Type Argument Description captureBoolean <optional>
Event capture option.
optionsBoolean <optional>
false Event capture option.
- Source:
Returns:
El class instance.
- Type
- Object
-
on(eventsToBind, handler, options)
-
Listen for events.
Parameters:
Name Type Description eventsToBindString | Array Name of event(s) to bind. Can be either space-separated string or array.
handlerfunction Function handler reference.
optionsObject | Boolean event options.
Properties
Name Type Description captureBoolean event capture option.
onceBoolean event once option.
passiveBoolean event passive option.
- Source:
Returns:
El class instance.
- Type
- Object
-
parent()
-
Return the parent element.
- Source:
Returns:
Parent element.
- Type
- Object
-
prepend(el)
-
Prepend an element or text node.
Parameters:
Name Type Description elObject | String Element to prepend or string to become text node to prepend.
- Source:
Returns:
El class instance.
- Type
- Object
-
prependHTML(html)
-
Prepend HTML
Parameters:
Name Type Description htmlString HTML string to prepend.
- Source:
Returns:
El class instance.
- Type
- Object
-
prependText(text)
-
Prepend Text
Parameters:
Name Type Description textString Text string to prepend.
- Source:
Returns:
El class instance.
- Type
- Object
-
remove()
-
Completely remove an element.
- Source:
-
removeAttribute(attr)
-
Remove single attribute.
Parameters:
Name Type Description attrString Attribute name to remove.
- Source:
Returns:
El class instance.
- Type
- Object
-
removeClass(myClass)
-
Removes a class. Accepts a space-separated string or an array.
Parameters:
Name Type Description myClassString | Array ClassName(s) to remove.
- Source:
Returns:
El class instance.
- Type
- Object
-
serialize( [returnType])
-
Transform an element value.
Parameters:
Name Type Argument Default Description returnTypeString <optional>
object The type of returned value. Either 'object', 'array', or 'string'.
- Source:
Returns:
The transformed value.
- Type
- Object | Array | String
-
setAttribute(attr, attrValue)
-
Set single attribute.
Parameters:
Name Type Description attrString Attribute name to set.
attrValueString Attribute value.
- Source:
Returns:
El class instance.
- Type
- Object
-
setHTML(html)
-
Sets the html content.
Parameters:
Name Type Description htmlString Html to set.
- Source:
Returns:
El class instance.
- Type
- Object
-
setKey($key)
-
Set the unique $key for an element.
Parameters:
Name Type Description $keyString $Key to set.
- Source:
Returns:
El class instance.
- Type
- Object
-
setStyles(styles)
-
Set styles.
Parameters:
Name Type Description stylesObject Styles to set.
- Source:
Returns:
El class instance.
- Type
- Object
-
setText(text)
-
Sets the text content.
Parameters:
Name Type Description textString Text to set.
- Source:
Returns:
El class instance.
- Type
- Object
-
setValue(val)
-
Sets the value property.
Parameters:
Name Type Description valString value to set
- Source:
Returns:
El class instance.
- Type
- Object
-
show()
-
Show element with display rule.
- Source:
Returns:
El class instance.
- Type
- Object
-
showFor( [speed])
-
Call show method, then hide for x amount of ms.
Parameters:
Name Type Argument Default Description speedNumber <optional>
200 Interval to show.
- Source:
Returns:
El class instance.
- Type
- Object
-
toggleCheck(state)
-
Toggles the checked state of the element.
Parameters:
Name Type Description stateBoolean Desired check state.
- Source:
Returns:
El class instance.
- Type
- Object
-
trigger(eventName [, params])
-
Trigger an event and dispatch it. Convenient for custom events.
Parameters:
Name Type Argument Description eventNameString Event to trigger.
paramsObject <optional>
Event options.
- Source:
Returns:
El class instance.
- Type
- Object
-
unbindEvents()
-
Unbind all events associated with an element.
- Source:
Returns:
El class instance.
- Type
- Object