Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions modules/angular2/src/compiler/html_tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,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 {
Expand Down
8 changes: 8 additions & 0 deletions modules/angular2/test/compiler/html_parser_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ export function main() {
]);
});

it('should not add the requiredParent when the parent is a template', () => {
expect(humanizeDom(parser.parse('<template><tr></tr></template>', 'TestComp')))
.toEqual([
[HtmlElementAst, 'template', 0],
[HtmlElementAst, 'tr', 1],
]);
});

it('should support explicit mamespace', () => {
expect(humanizeDom(parser.parse('<myns:div></myns:div>', 'TestComp')))
.toEqual([[HtmlElementAst, '@myns:div', 0]]);
Expand Down