fix(shadow_dom_emulation): handle the case when the array of element injectors has nulls
This commit is contained in:
parent
7aa031b3d3
commit
29f5ee0c29
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
Loading…
Reference in New Issue