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 {
804
804
cssPrefixWithPseudoSelectorFunctionMatch ;
805
805
const hasOuterHostNoCombinator = mainSelector . includes ( _polyfillHostNoCombinator ) ;
806
806
const scopedMainSelector = mainSelector . replace (
807
- _polyfillHostNoCombinatorReGlobal ,
807
+ _polyfillExactHostNoCombinatorReGlobal ,
808
808
`[${ hostSelector } ]` ,
809
809
) ;
810
810
@@ -982,6 +982,7 @@ const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
982
982
const _polyfillHostNoCombinatorWithinPseudoFunction = new RegExp (
983
983
`:.*(.*${ _polyfillHostNoCombinator } .*)` ,
984
984
) ;
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;
985
986
const _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 ] * ) / ;
986
987
const _polyfillHostNoCombinatorReGlobal = new RegExp ( _polyfillHostNoCombinatorRe , 'g' ) ;
987
988
const _shadowDOMSelectorsRe = [
Original file line number Diff line number Diff line change @@ -67,7 +67,17 @@ describe('ShadowCss', () => {
67
67
expect ( shim ( 'one[attr] {}' , 'contenta' ) ) . toEqualCss ( 'one[attr][contenta] {}' ) ;
68
68
expect ( shim ( '[is="one"] {}' , 'contenta' ) ) . toEqualCss ( '[is="one"][contenta] {}' ) ;
69
69
expect ( shim ( '[attr] {}' , 'contenta' ) ) . toEqualCss ( '[attr][contenta] {}' ) ;
70
+ } ) ;
71
+
72
+ it ( 'should transform :host with attributes and pseudo selectors' , ( ) => {
70
73
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
+ ) ;
71
81
} ) ;
72
82
73
83
it ( 'should handle escaped sequences in selectors' , ( ) => {
You can’t perform that action at this time.
0 commit comments