File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -351,10 +351,16 @@ class ComponentImpl extends ComponentBase {
351351 }
352352
353353 private override function handleSetComponentIndex (child : Component , index : Int ) {
354- if (index == cast ( this , Component ) .childComponents .length - 1 ) {
354+ if (index == this .childComponents .length - 1 ) {
355355 element .appendChild (child .element );
356356 } else {
357- HtmlUtils .insertBefore (cast (this , Component ).childComponents [index + 1 ].element , child .element );
357+ if (index == this .childComponents .indexOf (child ) - 1 ) {
358+ var before = this .childComponents [index ];
359+ HtmlUtils .insertBefore (before .element , child .element );
360+ } else {
361+ var before = this .childComponents [index + 1 ];
362+ HtmlUtils .insertBefore (before .element , child .element );
363+ }
358364 }
359365 }
360366
You can’t perform that action at this time.
0 commit comments