@@ -5,8 +5,10 @@ import { ContentView } from "tns-core-modules/ui/content-view";
55import { LayoutBase } from "tns-core-modules/ui/layouts/layout-base" ;
66import {
77 CommentNode ,
8+ InvisibleNode ,
89 NgElement ,
910 NgView ,
11+ TextNode ,
1012 ViewExtensions ,
1113 getViewClass ,
1214 getViewMeta ,
@@ -52,9 +54,8 @@ export class ViewUtil {
5254 }
5355
5456 public insertChild ( parent : any , child : NgElement , atIndex : number = - 1 ) {
55- if ( child instanceof CommentNode ) {
57+ if ( child instanceof InvisibleNode ) {
5658 child . templateParent = parent ;
57- return ;
5859 }
5960
6061 if ( ! parent || isDetachedElement ( child ) ) {
@@ -79,16 +80,11 @@ export class ViewUtil {
7980 parent . content = child ;
8081 } else if ( parent && parent . _addChildFromBuilder ) {
8182 parent . _addChildFromBuilder ( child . nodeName , child ) ;
82- } else {
83- // throw new Error("Parent can"t contain children: " + parent.nodeName + ", " + parent);
8483 }
8584 }
8685
8786 public removeChild ( parent : any , child : NgElement ) {
88- if ( ! parent ||
89- child instanceof CommentNode ||
90- isDetachedElement ( child ) ) {
91-
87+ if ( ! parent || isDetachedElement ( child ) ) {
9288 return ;
9389 }
9490
@@ -102,8 +98,6 @@ export class ViewUtil {
10298 }
10399 } else if ( isView ( parent ) ) {
104100 parent . _removeView ( child ) ;
105- } else {
106- // throw new Error("Unknown parent type: " + parent);
107101 }
108102 }
109103
@@ -112,17 +106,15 @@ export class ViewUtil {
112106 return parent . getChildIndex ( child ) ;
113107 } else if ( isContentView ( parent ) ) {
114108 return child === parent . content ? 0 : - 1 ;
115- } else {
116- // throw new Error("Parent can"t contain children: " + parent);
117109 }
118110 }
119111
120- public createComment ( ) : CommentNode {
112+ public createComment ( ) : InvisibleNode {
121113 return new CommentNode ( ) ;
122114 }
123115
124- public createText ( ) : CommentNode {
125- return new CommentNode ( ) ;
116+ public createText ( ) : InvisibleNode {
117+ return new TextNode ( ) ;
126118 }
127119
128120 public createView ( name : string ) : NgView {
0 commit comments