From a472eacc075036e85edea0bb62075f078610da53 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 21 Jul 2015 10:43:02 -0700 Subject: [PATCH] fix(content_projection): allow to project text nodes to a place without bindings Fixes #3163 Closes #3179 --- .../src/render/dom/view/proto_view_merger.ts | 14 ++++++++++++++ .../dom/view/proto_view_merger_integration_spec.ts | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/modules/angular2/src/render/dom/view/proto_view_merger.ts b/modules/angular2/src/render/dom/view/proto_view_merger.ts index abe275a64d..f977ecc315 100644 --- a/modules/angular2/src/render/dom/view/proto_view_merger.ts +++ b/modules/angular2/src/render/dom/view/proto_view_merger.ts @@ -27,6 +27,9 @@ export function mergeProtoViewsRecursively(protoViewRefs: List>, } } +function markBoundTextNodeParentsAsBoundElements(mergableProtoViews: ClonedProtoView[]) { + mergableProtoViews.forEach((mergableProtoView) => { + mergableProtoView.boundTextNodes.forEach((textNode) => { + var parentNode = textNode.parentNode; + if (isPresent(parentNode) && DOM.isElementNode(parentNode)) { + DOM.addClass(parentNode, NG_BINDING_CLASS); + } + }); + }); +} + function indexBoundTextNodes(mergableProtoViews: ClonedProtoView[]): Map { var boundTextNodeMap = new Map(); for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { diff --git a/modules/angular2/test/render/dom/view/proto_view_merger_integration_spec.ts b/modules/angular2/test/render/dom/view/proto_view_merger_integration_spec.ts index 0bc52e73aa..952f7bd3e8 100644 --- a/modules/angular2/test/render/dom/view/proto_view_merger_integration_spec.ts +++ b/modules/angular2/test/render/dom/view/proto_view_merger_integration_spec.ts @@ -98,6 +98,11 @@ export function main() { 'root', ['{{b}}', 'A()'], ['A({0})'])); + it('should project text interpolation to elements without bindings', + runAndAssert('root', ['{{b}}', '
'], [ + '
{0}
' + ])); + it('should project elements', runAndAssert('root', ['
', 'A()'], [ 'A(
)
'