diff --git a/modules/angular2/src/compiler/html_parser.ts b/modules/angular2/src/compiler/html_parser.ts index cf3474ba02..9d595b684e 100644 --- a/modules/angular2/src/compiler/html_parser.ts +++ b/modules/angular2/src/compiler/html_parser.ts @@ -134,6 +134,11 @@ class TreeBuilder { if (this.peek.type === HtmlTokenType.TAG_OPEN_END_VOID) { this._advance(); selfClosing = true; + if (namespacePrefix(fullName) == null && !getHtmlTagDefinition(fullName).isVoid) { + this.errors.push(HtmlTreeError.create( + fullName, startTagToken.sourceSpan.start, + `Only void and foreign elements can be self closed "${startTagToken.parts[1]}"`)); + } } else if (this.peek.type === HtmlTokenType.TAG_OPEN_END) { this._advance(); selfClosing = false; diff --git a/modules/angular2/test/compiler/html_parser_spec.ts b/modules/angular2/test/compiler/html_parser_spec.ts index d779f0dd4b..fd55214414 100644 --- a/modules/angular2/test/compiler/html_parser_spec.ts +++ b/modules/angular2/test/compiler/html_parser_spec.ts @@ -147,6 +147,16 @@ export function main() { expect(humanizeDom(parser.parse('