@domql/render 2.0.5 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +24 -1
- package/package.json +2 -2
- package/assign.js +0 -26
package/index.js
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Receives child and parent nodes as parametes
|
|
5
|
+
* and assigns them into real DOM tree
|
|
6
|
+
*/
|
|
7
|
+
export const appendNode = (node, parentNode) => {
|
|
8
|
+
parentNode.appendChild(node)
|
|
9
|
+
return node
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const insertNodeAfter = (node, siblingNode) => {
|
|
13
|
+
siblingNode.parentNode.insertBefore(node, siblingNode.nextSibling)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Receives elements and assigns the first
|
|
18
|
+
* parameter as a child of the second one
|
|
19
|
+
*/
|
|
20
|
+
export const assignNode = (element, parent, key, insertAfter) => {
|
|
21
|
+
parent[key || element.key] = element
|
|
22
|
+
if (element.tag !== 'shadow') {
|
|
23
|
+
(insertAfter ? insertNodeAfter : appendNode)(element.node, parent.node)
|
|
24
|
+
}
|
|
25
|
+
return element
|
|
26
|
+
}
|
package/package.json
CHANGED
package/assign.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Receives child and parent nodes as parametes
|
|
5
|
-
* and assigns them into real DOM tree
|
|
6
|
-
*/
|
|
7
|
-
export const appendNode = (node, parentNode) => {
|
|
8
|
-
parentNode.appendChild(node)
|
|
9
|
-
return node
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const insertNodeAfter = (node, siblingNode) => {
|
|
13
|
-
siblingNode.parentNode.insertBefore(node, siblingNode.nextSibling)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Receives elements and assigns the first
|
|
18
|
-
* parameter as a child of the second one
|
|
19
|
-
*/
|
|
20
|
-
export const assignNode = (element, parent, key, insertAfter) => {
|
|
21
|
-
parent[key || element.key] = element
|
|
22
|
-
if (element.tag !== 'shadow') {
|
|
23
|
-
(insertAfter ? insertNodeAfter : appendNode)(element.node, parent.node)
|
|
24
|
-
}
|
|
25
|
-
return element
|
|
26
|
-
}
|