fix(compiler): don’t lowercase attributes to support svg
This reverts commit b89c5bc5818c62e775b0b0211931a81a32fd0293 and adds an additional test. Closes #5166
This commit is contained in:
		
							parent
							
								
									63e853dcd7
								
							
						
					
					
						commit
						6133f2c08b
					
				| @ -43,9 +43,7 @@ function parseText(text: Text, indexInParent: number, parentSourceInfo: string): | |||||||
| function parseAttr(element: Element, parentSourceInfo: string, attrName: string, | function parseAttr(element: Element, parentSourceInfo: string, attrName: string, | ||||||
|                    attrValue: string): HtmlAttrAst { |                    attrValue: string): HtmlAttrAst { | ||||||
|   // TODO(tbosch): add source row/column source info from parse5 / package:html
 |   // TODO(tbosch): add source row/column source info from parse5 / package:html
 | ||||||
|   var lowerCaseAttrName = attrName.toLowerCase(); |   return new HtmlAttrAst(attrName, attrValue, `${parentSourceInfo}[${attrName}=${attrValue}]`); | ||||||
|   return new HtmlAttrAst(lowerCaseAttrName, attrValue, |  | ||||||
|                          `${parentSourceInfo}[${lowerCaseAttrName}=${attrValue}]`); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function parseElement(element: Element, indexInParent: number, | function parseElement(element: Element, indexInParent: number, | ||||||
|  | |||||||
| @ -81,11 +81,11 @@ export function main() { | |||||||
|               ]); |               ]); | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         it('should parse and lower case attributes on regular elements', () => { |         it('should parse attributes on svg elements case sensitive', () => { | ||||||
|           expect(humanizeDom(parser.parse('<div FoO="bar"></div>', 'TestComp'))) |           expect(humanizeDom(parser.parse('<svg viewBox="0"></svg>', 'TestComp'))) | ||||||
|               .toEqual([ |               .toEqual([ | ||||||
|                 [HtmlElementAst, 'div', 'TestComp > div:nth-child(0)'], |                 [HtmlElementAst, 'svg', 'TestComp > svg:nth-child(0)'], | ||||||
|                 [HtmlAttrAst, 'foo', 'bar', 'TestComp > div:nth-child(0)[foo=bar]'] |                 [HtmlAttrAst, 'viewBox', '0', 'TestComp > svg:nth-child(0)[viewBox=0]'] | ||||||
|               ]); |               ]); | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user