Methods
(p_element, p_parent)
AttachAppends a dom element into another one
Parameters:
Name | Type | Description |
---|---|---|
p_element |
Node | The element to be appended |
p_parent |
Node | Parent node to append the element into |
(p_element, p_parent, p_firstChildopt)
AttachFirstAppends or move an element at the beginning of the display list of another dom element. Note that if the element provided is not a child of the target parent, it will be removed from its previous parent.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p_element |
Node | The element to be appended or moved |
||
p_parent |
Node | Parent node to append or move the element into |
||
p_firstChild |
boolean |
<optional> |
true
|
If true, attach before the firstChild, otherwise attach before the firstChildElement |
(p_element)
DetachRemove a node from its parent, if any
Parameters:
Name | Type | Description |
---|---|---|
p_element |
Node |
(p_element, p_attributesopt, p_containeropt)
NewCreate a DOM Node of a given type with a given set of attributes.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p_element |
string | |||
p_attributes |
object |
<optional> |
null
|
inlined attributes & values |
p_container |
Node |
<optional> |
null
|
Parent node to append the new node into |
Examples:
let newNode = UTILS_DOM.New(`div`, { class:`foo`, ['data-title']:`bar` });
newNode == <div class="foo" data-title:"bar"></div> //dom element
(p_element, p_containeropt)
NewCloneCreate a clone of an existing DOM element.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p_element |
Node | Node to clone |
||
p_container |
Node |
<optional> |
null
|
Parent node to append the new node into |
(p_element) → {boolean}
OverflowsXTODO
Parameters:
Name | Type | Description |
---|---|---|
p_element |
Node |
(p_element) → {boolean}
OverflowsYTODO
Parameters:
Name | Type | Description |
---|---|---|
p_element |
Node |
(p_element, p_relativeopt)
RectReturns the bouding client rect of a given element, and if provided, relative to another dom element.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p_element |
Node | |||
p_relative |
Node |
<optional> |
null
|
(p_node, p_backOfNodeopt)
ToBackMove a node at the beginning (back) of the child list
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p_node |
Node | |||
p_backOfNode |
boolean |
<optional> |
false
|
If true, move the node at the back of the first child. Otherwise first childElement. |
(p_node, p_frontOfNodeopt)
ToFrontMove a node at the end (front) of the child list
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
p_node |
Node | |||
p_frontOfNode |
boolean |
<optional> |
false
|
If true, move the node at the front of the last child. Otherwise last childElement. |