diff --git a/modules/angular2/src/compiler/html_tags.ts b/modules/angular2/src/compiler/html_tags.ts
index a2b77fef3d..e45ff34d16 100644
--- a/modules/angular2/src/compiler/html_tags.ts
+++ b/modules/angular2/src/compiler/html_tags.ts
@@ -304,8 +304,16 @@ export class HtmlTagDefinition {
}
requireExtraParent(currentParent: string): boolean {
- return isPresent(this.requiredParents) &&
- (isBlank(currentParent) || this.requiredParents[currentParent.toLowerCase()] != true);
+ if (isBlank(this.requiredParents)) {
+ return false;
+ }
+
+ if (isBlank(currentParent)) {
+ return true;
+ }
+
+ let lcParent = currentParent.toLowerCase();
+ return this.requiredParents[lcParent] != true && lcParent != 'template';
}
isClosedByChild(name: string): boolean {
diff --git a/modules/angular2/test/compiler/html_parser_spec.ts b/modules/angular2/test/compiler/html_parser_spec.ts
index eb709c6113..a9217414f8 100644
--- a/modules/angular2/test/compiler/html_parser_spec.ts
+++ b/modules/angular2/test/compiler/html_parser_spec.ts
@@ -141,6 +141,14 @@ export function main() {
]);
});
+ it('should not add the requiredParent when the parent is a template', () => {
+ expect(humanizeDom(parser.parse('
', 'TestComp')))
+ .toEqual([
+ [HtmlElementAst, 'template', 0],
+ [HtmlElementAst, 'tr', 1],
+ ]);
+ });
+
it('should support explicit mamespace', () => {
expect(humanizeDom(parser.parse('', 'TestComp')))
.toEqual([[HtmlElementAst, '@myns:div', 0]]);