From 6133f2c08bd5adbafd7550bcd1b9a7ddf13d5a0f Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Fri, 6 Nov 2015 11:31:03 -0800 Subject: [PATCH] =?UTF-8?q?fix(compiler):=20don=E2=80=99t=20lowercase=20at?= =?UTF-8?q?tributes=20to=20support=20svg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b89c5bc5818c62e775b0b0211931a81a32fd0293 and adds an additional test. Closes #5166 --- modules/angular2/src/compiler/html_parser.ts | 4 +--- modules/angular2/test/compiler/html_parser_spec.ts | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/angular2/src/compiler/html_parser.ts b/modules/angular2/src/compiler/html_parser.ts index 2b3aaaf289..9d8767707d 100644 --- a/modules/angular2/src/compiler/html_parser.ts +++ b/modules/angular2/src/compiler/html_parser.ts @@ -43,9 +43,7 @@ function parseText(text: Text, indexInParent: number, parentSourceInfo: string): function parseAttr(element: Element, parentSourceInfo: string, attrName: string, attrValue: string): HtmlAttrAst { // TODO(tbosch): add source row/column source info from parse5 / package:html - var lowerCaseAttrName = attrName.toLowerCase(); - return new HtmlAttrAst(lowerCaseAttrName, attrValue, - `${parentSourceInfo}[${lowerCaseAttrName}=${attrValue}]`); + return new HtmlAttrAst(attrName, attrValue, `${parentSourceInfo}[${attrName}=${attrValue}]`); } function parseElement(element: Element, indexInParent: number, diff --git a/modules/angular2/test/compiler/html_parser_spec.ts b/modules/angular2/test/compiler/html_parser_spec.ts index 4bb5e16375..b8d1547146 100644 --- a/modules/angular2/test/compiler/html_parser_spec.ts +++ b/modules/angular2/test/compiler/html_parser_spec.ts @@ -81,11 +81,11 @@ export function main() { ]); }); - it('should parse and lower case attributes on regular elements', () => { - expect(humanizeDom(parser.parse('
', 'TestComp'))) + it('should parse attributes on svg elements case sensitive', () => { + expect(humanizeDom(parser.parse('', 'TestComp'))) .toEqual([ - [HtmlElementAst, 'div', 'TestComp > div:nth-child(0)'], - [HtmlAttrAst, 'foo', 'bar', 'TestComp > div:nth-child(0)[foo=bar]'] + [HtmlElementAst, 'svg', 'TestComp > svg:nth-child(0)'], + [HtmlAttrAst, 'viewBox', '0', 'TestComp > svg:nth-child(0)[viewBox=0]'] ]); });