File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -804,7 +804,7 @@ export class ShadowCss {
804804 cssPrefixWithPseudoSelectorFunctionMatch ;
805805 const hasOuterHostNoCombinator = mainSelector . includes ( _polyfillHostNoCombinator ) ;
806806 const scopedMainSelector = mainSelector . replace (
807- _polyfillHostNoCombinatorReGlobal ,
807+ _polyfillExactHostNoCombinatorReGlobal ,
808808 `[${ hostSelector } ]` ,
809809 ) ;
810810
@@ -982,6 +982,7 @@ const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
982982const _polyfillHostNoCombinatorWithinPseudoFunction = new RegExp (
983983 `:.*(.*${ _polyfillHostNoCombinator } .*)` ,
984984) ;
985+ const _polyfillExactHostNoCombinatorReGlobal = / - s h a d o w c s s h o s t - n o - c o m b i n a t o r / g;
985986const _polyfillHostNoCombinatorRe = / - s h a d o w c s s h o s t - n o - c o m b i n a t o r ( [ ^ \s ] * ) / ;
986987const _polyfillHostNoCombinatorReGlobal = new RegExp ( _polyfillHostNoCombinatorRe , 'g' ) ;
987988const _shadowDOMSelectorsRe = [
Original file line number Diff line number Diff line change @@ -67,7 +67,17 @@ describe('ShadowCss', () => {
6767 expect ( shim ( 'one[attr] {}' , 'contenta' ) ) . toEqualCss ( 'one[attr][contenta] {}' ) ;
6868 expect ( shim ( '[is="one"] {}' , 'contenta' ) ) . toEqualCss ( '[is="one"][contenta] {}' ) ;
6969 expect ( shim ( '[attr] {}' , 'contenta' ) ) . toEqualCss ( '[attr][contenta] {}' ) ;
70+ } ) ;
71+
72+ it ( 'should transform :host with attributes and pseudo selectors' , ( ) => {
7073 expect ( shim ( ':host [attr] {}' , 'contenta' , 'hosta' ) ) . toEqualCss ( '[hosta] [attr][contenta] {}' ) ;
74+ expect ( shim ( ':host(create-first-project) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
75+ 'create-first-project[hosta] {}' ,
76+ ) ;
77+ expect ( shim ( ':host[attr] {}' , 'contenta' , 'hosta' ) ) . toEqualCss ( '[attr][hosta] {}' ) ;
78+ expect ( shim ( ':host[attr]:where(:not(.cm-button)) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
79+ '[hosta][attr]:where(:not(.cm-button)) {}' ,
80+ ) ;
7181 } ) ;
7282
7383 it ( 'should handle escaped sequences in selectors' , ( ) => {
You can’t perform that action at this time.
0 commit comments