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
4 changes: 3 additions & 1 deletion modules/angular2/src/core/compiler/html_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ 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
return new HtmlAttrAst(attrName, attrValue, `${parentSourceInfo}[${attrName}=${attrValue}]`);
var lowerCaseAttrName = attrName.toLowerCase();
return new HtmlAttrAst(lowerCaseAttrName, attrValue,
`${parentSourceInfo}[${lowerCaseAttrName}=${attrValue}]`);
}

function parseElement(element: Element, indexInParent: number, parentSourceInfo: string):
Expand Down
8 changes: 8 additions & 0 deletions modules/angular2/test/core/compiler/html_parser_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ export function main() {
]);
});

it('should parse and lower case attributes on regular elements', () => {
expect(humanizeDom(parser.parse('<div FoO="bar"></div>', 'TestComp')))
.toEqual([
[HtmlElementAst, 'div', 'TestComp > div:nth-child(0)'],
[HtmlAttrAst, 'foo', 'bar', 'TestComp > div:nth-child(0)[foo=bar]']
]);
});

it('should parse attributes on template elements', () => {
expect(humanizeDom(parser.parse('<template k="v"></template>', 'TestComp')))
.toEqual([
Expand Down