Skip to content

Commit 1620328

Browse files
committed
add parents properties
1 parent 0ff094e commit 1620328

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/nodes/core/Node.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ class Node extends EventDispatcher {
8787
*/
8888
this.global = false;
8989

90+
/**
91+
* Create a list of parents for this node during the build process.
92+
*
93+
* @type {boolean}
94+
* @default false
95+
*/
96+
this.parents = false;
97+
9098
/**
9199
* This flag can be used for type testing.
92100
*
@@ -643,6 +651,14 @@ class Node extends EventDispatcher {
643651

644652
if ( childNode && childNode.isNode === true ) {
645653

654+
if ( childNode.parents === true ) {
655+
656+
const childProperties = builder.getNodeProperties( childNode );
657+
childProperties.parents = childProperties.parents || [];
658+
childProperties.parents.push( this );
659+
660+
}
661+
646662
childNode.build( builder );
647663

648664
}

0 commit comments

Comments
 (0)