src/mustacheparser.js
function handleStyles(tagName, styles) {
	styles = (styles || []).map(style => {
			let code = style;
			return code.replace(/[\r\n]*([^%\{;\}]+?)\{/gm, (global, match) => {
				if (match.trim().match(/^@/)) {
					return match + '{';
				}
				var selectors = match.split(',').map(selector => {
					selector = selector.trim();
					if (selector.match(/:host\b/) ||
						selector.match(new RegExp(`^\\s*${tagName}\\b`)) ||
						selector.match(/^\s*(?:(?:\d+%)|(?:from)|(?:to)|(?:@\w+)|\})\s*$/)) {
						return selector;
					}
					return tagName + ' ' + selector;
				});
				return global.replace(match, selectors.join(','));
			}).replace(/:host\b/gm, tagName) + '\n';
		});
	return styles;
}
function handleStyles(tagName, styles) {
	styles = (styles || []).map(style => {
			let code = style;
			return code.replace(/[\r\n]*([^%\{;\}]+?)\{/gm, (global, match) => {
				if (match.trim().match(/^@/)) {
					return match + '{';
				}
				var selectors = match.split(',').map(selector => {
					selector = selector.trim();
					if (selector.match(/:host\b/) ||
						selector.match(new RegExp(`^\\s*${tagName}\\b`)) ||
						selector.match(/^\s*(?:(?:\d+%)|(?:from)|(?:to)|(?:@\w+)|\})\s*$/)) {
						return selector;
					}
					return tagName + ' ' + selector;
				});
				return global.replace(match, selectors.join(','));
			}).replace(/:host\b/gm, tagName) + '\n';
		});
	return styles;
}
function handleStyles ( tagName , styles ) { styles = ( styles || [ ] ) . map ( style => { let code = style ; return code . replace ( / [\r\n]*([^%\{;\}]+?)\{ / gm , ( global , match ) => { if ( match . trim ( ) . match ( / ^@ / ) ) { return match + '{' ; } var selectors = match . split ( ',' ) . map ( selector => { selector = selector . trim ( ) ; if ( selector . match ( / :host\b / ) || selector . match ( new RegExp ( ` \\ ${ tagName } \\ ` ) ) || selector . match ( / ^\s*(?:(?:\d+%)|(?:from)|(?:to)|(?:@\w+)|\})\s*$ / ) ) { return selector ; } return tagName + ' ' + selector ; } ) ; return global . replace ( match , selectors . join ( ',' ) ) ; } ) . replace ( / :host\b / gm , tagName ) + '\n' ; } ) ; return styles ; }
parses style information from within a style tag makes sure it is localized
parses style information from within a style tag makes sure it is localized