A Module that abstracts Virtual DOM interactions. It's purpose is to perform actions on DOM-like Objects
- Source:
Methods
(inner) changed(node1, node2)
compares two VDOM nodes and returns true if they are different
Parameters:
Name | Type | Description |
---|---|---|
node1 |
VNode | |
node2 |
VNode |
- Source:
(inner) createDomElement(tagName, attributes, innerHTML) → {HTMLElement}
Creates a new HTML Element. If the attribute is a function it will add it as an EventListener. Otherwise as an attribute.
Parameters:
Name | Type | Description |
---|---|---|
tagName |
string | name of the tag |
attributes |
object | attributes or listeners to set in element |
innerHTML |
* | content of the tag |
- Source:
Returns:
- Type
- HTMLElement
(inner) diff($parent, oldNode, newNode, index)
Compares two VDOM nodes and applies the differences to the dom
Parameters:
Name | Type | Description |
---|---|---|
$parent |
HTMLElement | |
oldNode |
VNode | |
newNode |
VNode | |
index |
number |
- Source:
(inner) mount($root, view, state, diffing)
Renders given stateful view into given container
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$root |
HTMLElement | ||
view |
function | ||
state |
object | ||
diffing |
boolean | true |
- Source:
(inner) mountMVC($root, model, view, controller, diffing)
Renders given stateful view into given container (MVC approach)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$root |
HTMLElement | ||
model |
object | ||
view |
function | ||
controller |
any | ||
diffing |
boolean | true |
- Source:
(inner) render(node) → {HTMLElement}
Renders a given node object Considers ELEMENT_NODE AND TEXT_NODE https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
Parameters:
Name | Type | Description |
---|---|---|
node |
VNode |
- Source:
Returns:
- Type
- HTMLElement
(inner) toVDOM($node) → {VNode}
Converts a DOM Node to a Virtual Node
Parameters:
Name | Type | Description |
---|---|---|
$node |
HTMLElement |
- Source:
Returns:
- Type
- VNode
(inner) vNode(tagName, attributes, …nodes) → {VNode}
Creates a node object which can be rendered
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tagName |
string | ||
attributes |
object | ||
nodes |
Array.<VNode> | VNode | any |
<repeatable> |
- Source:
Returns:
- Type
- VNode
Type Definitions
VNode
Type:
- Object
- Source: