- Copyright:
- (c) Copyright 2013 - 2016 AV Digital Media Ltd. All Rights Reserved. No unauthorized copying, distribution or modification to this code in whole or in part is permitted without the express permission of AV Digital Media Ltd (UK).
Properties:
Name | Type | Description |
---|---|---|
autoTouch |
Boolean | Determines whether touch events should automatically be added when the standard mouseevents are added to an element |
This is the DOM manipulation utility with an array of methods that can add and remove elements from the dom, find children, add and remove events and set the element content
Classes
Methods
(protected, static) $(value, parent)
aim.$ Main Object creation, this will check if there is a single object or multiple objects
Parameters:
Name | Type | Description |
---|---|---|
value |
String | The string value |
parent |
Object | The optional parent item, document used else |
(protected, static) addClass(node, values)
Add a class or multiple classes separated by a space
Parameters:
Name | Type | Description |
---|---|---|
node |
node | The HTML Element as an Element or AIM.$ |
values |
String | The value of the class/prop/attr |
(protected, static) addEvent(object, evnt, callback, bubbles)
Set and event for an element
Parameters:
Name | Type | Description |
---|---|---|
object |
object | The element to bind the event to |
evnt |
string | The event name to bind |
callback |
function | The callback function to bind to |
bubbles |
boolean | Determine whether event bubbling supported |
(protected, static) append(content, node)
Append content to a node
Parameters:
Name | Type | Description |
---|---|---|
content |
String | The content to append |
node |
Node | HTML Element to insert |
(protected, static) appendTo(node, parent)
Append a new node into the supplied parent node
Parameters:
Name | Type | Description |
---|---|---|
node |
HTMLElement | HTML Element to insert |
parent |
Boolean | HTML parent element to append to |
(protected, static) attr(node, name, value)
Set or Get an attribute value for an element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
name |
String | The name of the attribute |
value |
String | Optional value for the attribute |
(protected, static) bind(item, evnt, callback, bubbles, scope)
Adds a single or multiple events to an object
Parameters:
Name | Type | Description |
---|---|---|
item |
Object | The object to bind the event to |
evnt |
String | The event name to bind |
callback |
function | The callback function to bind to |
bubbles |
Boolean | Determine whether event bubbling supported |
scope |
Object | The scope of the function |
Returns:
The binding object with the function binding references
(protected, static) checked(node, value)
INPUT[type="checkbox"] Elements only get the checked status
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element |
value |
String | Optional value to set |
(protected, static) checkTouchEvent(evnt, touchEvent)
Check touchEvent, determines whether the corresponding mousedown, mouseup events should automatically have their touch equivalents added
Parameters:
Name | Type | Description |
---|---|---|
evnt |
String | The event name |
touchEvent |
String | The touchevent name |
Returns:
The touch status as a boolean
(protected, static) children(node)
Get all the child nodes of a specified element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element to style |
(protected, static) classes(node, values)
Get or Set the class attribute for an element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
values |
String | The value of the class/prop/attr |
(protected, static) clone(object, evnt)
Clone an element and return the object, only AIM.Dom clones will clone the object events
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The object to clone |
evnt |
String | Deep clone the node including all events |
Returns:
The new cloned Element
(private, static) convert(htmlString)
Convert a HTML string into HTML elements
Parameters:
Name | Type | Description |
---|---|---|
htmlString |
String | The string to convert |
Returns:
The string converted to html elements
(protected, static) create(data, as$)
Create a new dom element
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The data for the creation {type:'nav',content:'This is',classes:'test-3 bar-1',attributes:{id:'ele-3-id', 'data-type':56}} |
as$ |
Boolean | Determines whether the object returned is a HTMLElement or an AIM.Dom object |
Returns:
The new dom element created or the aim.$ object depending on the as$ option
(protected, static) createElement(style, parent, content, type, attributes)
Create a DOM element, plain an simple no aim.$ is involved
Parameters:
Name | Type | Description |
---|---|---|
style |
String | The style classes to add to the element |
parent |
object | The parent to append the element to |
content |
String | Optional default content for the element |
type |
String | Optional type of the element, other than div |
attributes |
String | Optional attributes to add to the element |
Returns:
The new dom element created so that it may be reference if required
(protected, static) css(node, properties)
Set the style properties for a specific element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
properties |
Object | The list of styles to adjust with their values |
(protected, static) destroy(object)
Destroy an AIM.Dom Object, this will clean up any event references and remove the element from the dom, the reference to the object created in any application will be nullified
Parameters:
Name | Type | Description |
---|---|---|
object |
Node | The AIM.Dom object to destroy |
(protected, static) disabled(node)
Set an element as disabled
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
(protected, static) dispatch(object, evnt)
Dispatch an event to an object with an event binding
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The object to dispatch the event for |
evnt |
String | The event name to dispatch |
(protected, static) display(node, display)
Set the dislay style for an element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
display |
String | The display type will accept a list of valid CSS selector options for "display" |
(protected, static) doNormalize(node)
Normalise method, which adds all text node values together, in the event the inbuilt normalise function does not work correctly
Parameters:
Name | Type | Description |
---|---|---|
node |
HTMLElement | The node to check |
(private, static) each(node, callback)
Each function for the methods to call and execute their functionality on each node
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
callback |
function | The callback function to execute |
(protected, static) empty(node)
Empty an element of all of its contents
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element |
(protected, static) enabled(node)
Set an element as enabled
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
(protected, static) existsInDOM(item)
Check if an element exists in the dom
Parameters:
Name | Type | Description |
---|---|---|
item |
HTMLElement | The value to check exists in the dom |
(protected, static) first(parent)
Return the first child node of a parent element
Parameters:
Name | Type | Description |
---|---|---|
parent |
Node | The HTML Element |
Returns:
The first child node if any exists
(protected, static) focus(node)
Set the focus of a specified element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
(private, static) group(list)
Create an object for a group of elements
Parameters:
Name | Type | Description |
---|---|---|
list |
NodeList | The group of elements to return as an array of AIM.$ |
Returns:
The array of items as a group list
(protected, static) has(node, parent)
Check if a node contains a specific node
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element |
parent |
Node | The HTML Element |
(protected, static) hasClass(node, value)
Determines if an element has a class
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
value |
String | The value of the class |
(protected, static) height(node, value)
Get the height of a specific element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
value |
String | The value to set for the height |
(protected, static) hexToRgb(hex)
Converts a HEX value to an RGB value, primarily used when adding styles via the CSS function
Parameters:
Name | Type | Description |
---|---|---|
hex |
String | value string to convert to RGB |
Returns:
The RGB value of the hex string
(protected, static) html(node, value)
Return the html for an element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element |
value |
String | Optional value to set |
(protected, static) insert(node, parent)
Insert a new node into a parent item, special NOTE this will NOT insert multiple nodes that are not nested in a PARENT, only the the FIRST node will be captured
Parameters:
Name | Type | Description |
---|---|---|
node |
HTMLElement | HTML Element to insert |
parent |
Boolean | HTML parent element to append to |
(protected, static) insertAfter(node, reference)
Insert a node after the reference item
Parameters:
Name | Type | Description |
---|---|---|
node |
HTMLElement | HTML Element to insert |
reference |
Boolean | HTML reference element |
(protected, static) insertBefore(node, reference)
Insert a node before the reference item
Parameters:
Name | Type | Description |
---|---|---|
node |
HTMLElement | HTML Element to insert |
reference |
Boolean | HTML reference element |
(protected, static) isHTML(item)
Check if an object is a html element
Parameters:
Name | Type | Description |
---|---|---|
item |
* | The value to check if is dom element |
Returns:
The is html status as a boolean
(protected, static) last(parent)
Return the last child node of a parent element
Parameters:
Name | Type | Description |
---|---|---|
parent |
Node | The HTML Element |
(protected, static) merge(parent)
Merge all child TEXT nodes of a parent object
Parameters:
Name | Type | Description |
---|---|---|
parent |
Node | The HTML Element |
(private, static) objectType(item)
Check if the item supplied is an aim.dom Object i.e. created from the "single" function initialization
Parameters:
Name | Type | Description |
---|---|---|
item |
* | The item to check |
Returns:
The aim object type which is has the "node" and "type" properties
(protected, static) parent(node)
Get the parent of a given node
Parameters:
Name | Type | Description |
---|---|---|
node |
HTMLElement | HTML Element to find the parent for |
(protected, static) prop(node, name, value)
Set or Get a property value for an element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
name |
String | The name of the attribute |
value |
String | Optional value for the property |
(protected, static) remove(child, parent)
Remove a node from the dom, this will not destroy the AIM.Dom reference that may have been created, not does it clear any events assigned to the element
Parameters:
Name | Type | Description |
---|---|---|
child |
Node | The HTML Element to be removed |
parent |
Node | The HTML Element |
(protected, static) removeClass(node, values)
Remove a class or multiple classes separated by a space
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
values |
String | The value of the class/prop/attr |
(protected, static) removeEvent(object, evnt, callback, bubbles)
Clear and event for an element
Parameters:
Name | Type | Description |
---|---|---|
object |
object | The element to unbind the event from |
evnt |
string | The event name to unbind |
callback |
function | The callback function to bind to |
bubbles |
boolean | Determine whether event bubbling supported |
(protected, static) replace(newChild, child, parent)
Replace a node with an alternate node, the original node reference is maintained
Parameters:
Name | Type | Description |
---|---|---|
newChild |
Node | The HTML Element |
child |
Node | The HTML Element to be replaced |
parent |
Node | The parent HTML Element |
(protected, static) select(selectors, {Node}{String}, all)
Select an element or group of elements from the dom.
Parameters:
Name | Type | Description |
---|---|---|
selectors |
String | String of comma separated selectors to find |
{Node}{String} |
boolean | parentAll - Can either represent the all with the parent defaulting to document or be a parent |
all |
Boolean | Boolean value, will find all selectors of a type, false or undefined will return the first instance only |
Returns:
The method will either return: null if nothing found, Html Element id 1 element found, Node List if multiple elements found
(protected, static) selectedIndex(node, value)
SELECT Elements only get the selected Index
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element |
value |
String | Optional value to set |
(protected, static) selectedValue(node, value)
SELECT Elements only get the selected Value
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element |
value |
String | Optional value to set |
(protected, static) tags(node)
Returns all tags for a specified element or specific tags
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element to style |
(protected, static) text(node, value)
Return the text for an element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element |
value |
String | Optional value to set |
(protected, static) unbind(objects, evnt, callback, bubbles)
Removes an event from a HTML element
Parameters:
Name | Type | Description |
---|---|---|
objects |
Object | The object to unbind the event from |
evnt |
String | The event name to unbind |
callback |
function | The callback function to bind to |
bubbles |
Boolean | Determine whether event bubbling supported |
(protected, static) unbindAll(object)
Clear all assigned events for an object
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The object to unbind the events for |
Returns:
The cloned object, since it is easy to remove by cloning
(protected, static) val(node, value)
Return the val for an element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element |
value |
String | Optional value to set |
(protected, static) width(node, value)
Get the width of a specific element
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The HTML Element as an Element or AIM.$ |
value |
String | The value to set for the width |