MCPcopy Create free account
hub / github.com/angular/angular / _scopeSelectors

Method _scopeSelectors

packages/compiler/src/shadow_css.ts:594–612  ·  view source on GitHub ↗
(cssText: string, scopeSelector: string, hostSelector: string)

Source from the content-addressed store, hash-verified

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

Callers 1

_scopeCssTextMethod · 0.95

Calls 4

_scopeSelectorMethod · 0.95
processRulesFunction · 0.85
someMethod · 0.80

Tested by

no test coverage detected