(
selector: string,
scopeSelector: string,
hostSelector: string,
)
| 701 | |
| 702 | // scope via name and [is=name] |
| 703 | private _applySimpleSelectorScope( |
| 704 | selector: string, |
| 705 | scopeSelector: string, |
| 706 | hostSelector: string, |
| 707 | ): string { |
| 708 | // In Android browser, the lastIndex is not reset when the regex is used in String.replace() |
| 709 | _polyfillHostRe.lastIndex = 0; |
| 710 | if (_polyfillHostRe.test(selector)) { |
| 711 | const replaceBy = `[${hostSelector}]`; |
| 712 | let result = selector; |
| 713 | while (result.match(_polyfillHostNoCombinatorRe)) { |
| 714 | result = result.replace(_polyfillHostNoCombinatorRe, (_hnc, selector) => { |
| 715 | return selector.replace( |
| 716 | /([^:\)]*)(:*)(.*)/, |
| 717 | (_: string, before: string, colon: string, after: string) => { |
| 718 | return before + replaceBy + colon + after; |
| 719 | }, |
| 720 | ); |
| 721 | }); |
| 722 | } |
| 723 | return result.replace(_polyfillHostRe, replaceBy); |
| 724 | } |
| 725 | |
| 726 | return scopeSelector + ' ' + selector; |
| 727 | } |
| 728 | |
| 729 | // return a selector with [name] suffix on each simple selector |
| 730 | // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */ |
no test coverage detected