MCPcopy
hub / github.com/angular/angular / _scopeSelectorPart

Method _scopeSelectorPart

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

Source from the content-addressed store, hash-verified

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