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

Method _scopeSelectorPart

packages/compiler/src/shadow_css.ts:748–773  ·  view source on GitHub ↗
(p: string)

Source from the content-addressed store, hash-verified

746 const attrName = `[${scopeSelector}]`;
747
748 const _scopeSelectorPart = (p: string) => {
749 let scopedP = p.trim();
750
751 if (!scopedP) {
752 return p;
753 }
754
755 if (p.includes(_polyfillHostNoCombinator)) {
756 scopedP = this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
757 if (!p.match(_polyfillHostNoCombinatorOutsidePseudoFunction)) {
758 const [_, before, colon, after] = scopedP.match(/([^:]*)(:*)([\s\S]*)/)!;
759 scopedP = before + attrName + colon + after;
760 }
761 } else {
762 // remove :host since it should be unnecessary
763 const t = p.replace(_polyfillHostRe, '');
764 if (t.length > 0) {
765 const matches = t.match(/([^:]*)(:*)([\s\S]*)/);
766 if (matches) {
767 scopedP = matches[1] + attrName + matches[2] + matches[3];
768 }
769 }
770 }
771
772 return scopedP;
773 };
774
775 // Wraps `_scopeSelectorPart()` to not use it directly on selectors with
776 // pseudo selector functions like `:where()`. Selectors within pseudo selector

Callers

nothing calls this directly

Calls 3

matchMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected