From 1f35048d54d304b066ca0d33245fe8312089b112 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Tue, 8 Dec 2015 09:01:15 -0800 Subject: [PATCH] feat(TemplateParser): allow template elements regardless the namespace Closes #5703 --- modules/angular2/src/compiler/template_parser.ts | 4 +++- modules/angular2/test/compiler/template_parser_spec.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/angular2/src/compiler/template_parser.ts b/modules/angular2/src/compiler/template_parser.ts index 9e4fcd62b0..2e9c5a77c9 100644 --- a/modules/angular2/src/compiler/template_parser.ts +++ b/modules/angular2/src/compiler/template_parser.ts @@ -7,6 +7,7 @@ import {Parser, AST, ASTWithSource} from 'angular2/src/core/change_detection/cha import {TemplateBinding} from 'angular2/src/core/change_detection/parser/ast'; import {CompileDirectiveMetadata} from './directive_metadata'; import {HtmlParser} from './html_parser'; +import {splitHtmlTagNamespace} from './html_tags'; import {ParseSourceSpan, ParseError, ParseLocation} from './parse_util'; @@ -215,7 +216,8 @@ class TemplateParseVisitor implements HtmlAstVisitor { } }); - var isTemplateElement = nodeName.toLowerCase() == TEMPLATE_ELEMENT; + var lcElName = splitHtmlTagNamespace(nodeName.toLowerCase())[1]; + var isTemplateElement = lcElName == TEMPLATE_ELEMENT; var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); var directives = this._createDirectiveAsts( element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), diff --git a/modules/angular2/test/compiler/template_parser_spec.ts b/modules/angular2/test/compiler/template_parser_spec.ts index 061ea32eed..59f3cd5952 100644 --- a/modules/angular2/test/compiler/template_parser_spec.ts +++ b/modules/angular2/test/compiler/template_parser_spec.ts @@ -500,6 +500,15 @@ There is no directive with "exportAs" set to "dirA" ("
]#a="dirA">< expect(humanizeTplAst(parse('', []))) .toEqual([[EmbeddedTemplateAst]]); }); + + it('should create embedded templates for