File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -32,14 +32,16 @@ class ContentPort {
32
32
33
33
content (dom.Element elt) {
34
34
var hash = elt.hashCode;
35
- var beginComment = new dom. Comment ( "content $ hash " ) ;
35
+ var beginComment = null ;
36
36
37
37
if (_childNodes.isNotEmpty) {
38
+ beginComment = new dom.Comment ("content $hash " );
38
39
elt.parent.insertBefore (beginComment, elt);
39
40
elt.parent.insertAllBefore (_childNodes, elt);
40
41
elt.parent.insertBefore (new dom.Comment ("end-content $hash " ), elt);
41
42
_childNodes = [];
42
43
}
44
+
43
45
elt.remove ();
44
46
return beginComment;
45
47
}
@@ -48,6 +50,10 @@ class ContentPort {
48
50
// Search for endComment and extract everything in between.
49
51
// TODO optimize -- there may be a better way of pulling out nodes.
50
52
53
+ if (_beginComment == null ) {
54
+ return ;
55
+ }
56
+
51
57
var endCommentText = "end-${_beginComment .text }" ;
52
58
53
59
var next;
Original file line number Diff line number Diff line change @@ -348,6 +348,14 @@ void main() {
348
348
expect (element).toHaveText ('And jump' );
349
349
}));
350
350
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
+
351
359
it ('should store ElementProbe with Elements' , async (() {
352
360
_.compile ('<div><simple>innerText</simple></div>' );
353
361
microLeap ();
You can’t perform that action at this time.
0 commit comments