Move normalizeTemplateAttributes method to DirectiveParser
This commit is contained in:
		| @@ -20,13 +20,4 @@ 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"'); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -43,4 +43,13 @@ export class DirectiveParser extends AbstractTemplateParser implements ParserInt | ||||
| 		return collection; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * 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"'); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user