diff options
Diffstat (limited to 'source/libs/utils.ts')
-rw-r--r-- | source/libs/utils.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/libs/utils.ts b/source/libs/utils.ts index 0348690f..73b5fb09 100644 --- a/source/libs/utils.ts +++ b/source/libs/utils.ts @@ -149,3 +149,11 @@ export function reportBug(featureName: string, bugName: string): void { console.log('Find existing issues:\n' + String(issuesUrl)); console.log('Open new issue:\n' + String(newIssueUrl)); } + +/** + * Prepend `:scope >` to a single or group of css selectors. + * @param {string} selector A css selector. + */ +export function getScopedSelector(selector: string): string { + return selector.split(',').map(sub => `:scope > ${sub.trim()}`).join(','); +} |