@@ -59,15 +59,14 @@ const linkDiv = function (this: MindElixirInstance, mainNode?: Wrapper) {
5959 if ( mainNode && mainNode !== el ) {
6060 continue
6161 }
62- if ( el . childElementCount ) {
63- const svg = createLinkSvg ( 'subLines' )
64- // svg tag name is lower case
65- const svgLine = el . lastChild as SVGSVGElement
66- if ( svgLine . tagName === 'svg' ) svgLine . remove ( )
67- el . appendChild ( svg )
68-
69- traverseChildren ( this , svg , branchColor , el , direction , true )
70- }
62+
63+ const svg = createLinkSvg ( 'subLines' )
64+ // svg tag name is lower case
65+ const svgLine = el . lastChild as SVGSVGElement
66+ if ( svgLine . tagName === 'svg' ) svgLine . remove ( )
67+ el . appendChild ( svg )
68+
69+ traverseChildren ( this , svg , branchColor , el , direction , true )
7170 }
7271
7372 this . renderArrow ( )
@@ -87,6 +86,7 @@ const traverseChildren = function (
8786) {
8887 const parent = wrapper . firstChild
8988 const children = wrapper . children [ 1 ] . children
89+ if ( children . length === 0 ) return
9090
9191 const pT = parent . offsetTop
9292 const pL = parent . offsetLeft
@@ -120,10 +120,7 @@ const traverseChildren = function (
120120 continue
121121 }
122122
123- const nextChildren = child . children [ 1 ] . children
124- if ( nextChildren . length > 0 ) {
125- traverseChildren ( mei , svgContainer , bc , child , direction )
126- }
123+ traverseChildren ( mei , svgContainer , bc , child , direction )
127124 }
128125}
129126
0 commit comments