diff --git a/modules/angular2/src/change_detection/abstract_change_detector.js b/modules/angular2/src/change_detection/abstract_change_detector.js index 685ff52bd2..ab416d9e86 100644 --- a/modules/angular2/src/change_detection/abstract_change_detector.js +++ b/modules/angular2/src/change_detection/abstract_change_detector.js @@ -33,6 +33,10 @@ export class AbstractChangeDetector extends ChangeDetector { cd.parent = this; } + removeShadowDomChild(cd:ChangeDetector) { + ListWrapper.remove(this.shadowDomChildren, cd); + } + remove() { this.parent.removeChild(this); } diff --git a/modules/angular2/test/change_detection/change_detection_spec.js b/modules/angular2/test/change_detection/change_detection_spec.js index 5b60b8158d..fb28ee07c3 100644 --- a/modules/angular2/test/change_detection/change_detection_spec.js +++ b/modules/angular2/test/change_detection/change_detection_spec.js @@ -484,6 +484,13 @@ export function main() { expect(parent.lightDomChildren).toEqual([]); }); + + it("should remove shadow dom children", () => { + parent.addShadowDomChild(child); + parent.removeShadowDomChild(child); + + expect(parent.shadowDomChildren.length).toEqual(0); + }); }); });