(cssText: string, scopeSelector: string, hostSelector: string)
| 591 | |
| 592 | // change a selector like 'div' to 'name div' |
| 593 | private _scopeSelectors(cssText: string, scopeSelector: string, hostSelector: string): string { |
| 594 | return processRules(cssText, (rule: CssRule) => { |
| 595 | let selector = rule.selector; |
| 596 | let content = rule.content; |
| 597 | if (rule.selector[0] !== '@') { |
| 598 | selector = this._scopeSelector({ |
| 599 | selector, |
| 600 | scopeSelector, |
| 601 | hostSelector, |
| 602 | isParentSelector: true, |
| 603 | }); |
| 604 | } else if (scopedAtRuleIdentifiers.some((atRule) => rule.selector.startsWith(atRule))) { |
| 605 | content = this._scopeSelectors(rule.content, scopeSelector, hostSelector); |
| 606 | } else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) { |
| 607 | content = this._stripScopingSelectors(rule.content); |
| 608 | } |
| 609 | return new CssRule(selector, content); |
| 610 | }); |
| 611 | } |
| 612 | |
| 613 | /** |
| 614 | * Handle a css text that is within a rule that should not contain scope selectors by simply |
no test coverage detected