fix(compiler): properly shim :host:before and :host(:before) (#12171)
				
					
				
			fixes #12165
This commit is contained in:
		
							parent
							
								
									f782b08f58
								
							
						
					
					
						commit
						aa92512ac6
					
				| @ -381,7 +381,10 @@ export class ShadowCss { | ||||
| 
 | ||||
|     if (_polyfillHostRe.test(selector)) { | ||||
|       const replaceBy = this.strictStyling ? `[${hostSelector}]` : scopeSelector; | ||||
|       return selector.replace(_polyfillHostNoCombinatorRe, (hnc, selector) => selector + replaceBy) | ||||
|       return selector | ||||
|           .replace( | ||||
|               _polyfillHostNoCombinatorRe, | ||||
|               (hnc, selector) => selector[0] === ':' ? replaceBy + selector : selector + replaceBy) | ||||
|           .replace(_polyfillHostRe, replaceBy + ' '); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -112,10 +112,8 @@ export function main() { | ||||
|       it('should handle no context', | ||||
|          () => { expect(s(':host {}', 'a', 'a-host')).toEqual('[a-host] {}'); }); | ||||
| 
 | ||||
|       it('should handle tag selector', () => { | ||||
|         expect(s(':host(ul) {}', 'a', 'a-host')).toEqual('ul[a-host] {}'); | ||||
| 
 | ||||
|       }); | ||||
|       it('should handle tag selector', | ||||
|          () => { expect(s(':host(ul) {}', 'a', 'a-host')).toEqual('ul[a-host] {}'); }); | ||||
| 
 | ||||
|       it('should handle class selector', | ||||
|          () => { expect(s(':host(.x) {}', 'a', 'a-host')).toEqual('.x[a-host] {}'); }); | ||||
| @ -141,6 +139,11 @@ export function main() { | ||||
|         expect(s(':host([a="b"],[c=d]) {}', 'a', 'a-host')) | ||||
|             .toEqual('[a="b"][a-host], [c="d"][a-host] {}'); | ||||
|       }); | ||||
| 
 | ||||
|       it('should handle pseudo selector', () => { | ||||
|         expect(s(':host(:before) {}', 'a', 'a-host')).toEqual('[a-host]:before {}'); | ||||
|         expect(s(':host:before {}', 'a', 'a-host')).toEqual('[a-host]:before {}'); | ||||
|       }); | ||||
|     }); | ||||
| 
 | ||||
|     describe((':host-context'), () => { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user