Move _normalizeTemplateAttributes to AbstractTemplateParser
This commit is contained in:
		
				
					committed by
					
						 Kim Biesbjerg
						Kim Biesbjerg
					
				
			
			
				
	
			
			
			
						parent
						
							07fa9fc5b1
						
					
				
				
					commit
					ef574a2d4f
				
			| @@ -20,4 +20,13 @@ export abstract class AbstractTemplateParser { | ||||
| 		return ''; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Angular's `[attr]="'val'"` syntax is not valid HTML, | ||||
| 	 * so it can't be parsed by standard HTML parsers. | ||||
| 	 * This method replaces `[attr]="'val'""` with `attr="val"` | ||||
| 	 */ | ||||
| 	protected _normalizeTemplateAttributes(template: string): string { | ||||
| 		return template.replace(/\[([^\]]+)\]="'([^\"]*)'"/g, '$1="$2"'); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -33,13 +33,4 @@ export class DirectiveParser extends AbstractTemplateParser implements ParserInt | ||||
| 		return results; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Angular's `[attr]="'val'"` syntax is not valid HTML, | ||||
| 	 * so Cheerio is not able to parse it. | ||||
| 	 * This method replaces `[attr]="'val'""` with `attr="val"` | ||||
| 	 */ | ||||
| 	protected _normalizeTemplateAttributes(template: string): string { | ||||
| 		return template.replace(/\[([^\]]+)\]="'([^\"]*)'"/g, '$1="$2"'); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user