This repository was archived by the owner on Feb 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -32,14 +32,16 @@ class ContentPort {
3232
3333 content (dom.Element elt) {
3434 var hash = elt.hashCode;
35- var beginComment = new dom. Comment ( "content $ hash " ) ;
35+ var beginComment = null ;
3636
3737 if (_childNodes.isNotEmpty) {
38+ beginComment = new dom.Comment ("content $hash " );
3839 elt.parent.insertBefore (beginComment, elt);
3940 elt.parent.insertAllBefore (_childNodes, elt);
4041 elt.parent.insertBefore (new dom.Comment ("end-content $hash " ), elt);
4142 _childNodes = [];
4243 }
44+
4345 elt.remove ();
4446 return beginComment;
4547 }
@@ -48,6 +50,10 @@ class ContentPort {
4850 // Search for endComment and extract everything in between.
4951 // TODO optimize -- there may be a better way of pulling out nodes.
5052
53+ if (_beginComment == null ) {
54+ return ;
55+ }
56+
5157 var endCommentText = "end-${_beginComment .text }" ;
5258
5359 var next;
Original file line number Diff line number Diff line change @@ -348,6 +348,14 @@ void main() {
348348 expect (element).toHaveText ('And jump' );
349349 }));
350350
351+ it ('should safely remove transcluding components that transclude no content' , async (() {
352+ _.rootScope.context['flag' ] = true ;
353+ _.compile ('<div ng-if=flag><simple></simple></div>' );
354+ microLeap (); _.rootScope.apply ();
355+ _.rootScope.context['flag' ] = false ;
356+ microLeap (); _.rootScope.apply ();
357+ }));
358+
351359 it ('should store ElementProbe with Elements' , async (() {
352360 _.compile ('<div><simple>innerText</simple></div>' );
353361 microLeap ();
You can’t perform that action at this time.
0 commit comments