fix(shadow_dom_emulation): handle the case when the array of element injectors has nulls

This commit is contained in:
vsavkin 2015-02-20 15:19:51 -08:00
parent 7aa031b3d3
commit 29f5ee0c29
2 changed files with 15 additions and 1 deletions

View File

@ -105,7 +105,8 @@ export class LightDom {
var viewInj = this.lightDomView.elementInjectors;
this.roots = ListWrapper.map(this.nodes, (n) =>
new _Root(n, ListWrapper.find(viewInj, (inj) => inj.forElement(n))));
new _Root(n, ListWrapper.find(viewInj,
(inj) => isPresent(inj) ? inj.forElement(n) : false)));
return this.roots;
}

View File

@ -180,6 +180,19 @@ export function main() {
expect(toHtml(lightDom.expandedDomNodes())).toEqual(["<a></a>"]);
});
it("should work when the element injector array contains nulls", () => {
var lightDomEl = el("<div><a></a></div>")
var lightDomView = new FakeView([null]);
var lightDom = new LightDom(
lightDomView,
new FakeView(),
lightDomEl);
expect(toHtml(lightDom.expandedDomNodes())).toEqual(["<a></a>"]);
});
});
describe("redistribute", () => {