summaryrefslogtreecommitdiff
path: root/source/libs/utils.ts
diff options
context:
space:
mode:
authorGravatar arnaudvalle <arnaudvalle@users.noreply.github.com> 2020-03-13 16:03:26 +0100
committerGravatar GitHub <noreply@github.com> 2020-03-13 16:03:26 +0100
commit72607c8fb29a9a076151522dd884b874366a20dd (patch)
tree1cd4bfa8a29670cc6a180c362e1200c37239fe7c /source/libs/utils.ts
parente7e78d2a41692370e0b1d9f6b16cdf28e6585982 (diff)
downloadrefined-github-72607c8fb29a9a076151522dd884b874366a20dd.tar.gz
refined-github-72607c8fb29a9a076151522dd884b874366a20dd.tar.zst
refined-github-72607c8fb29a9a076151522dd884b874366a20dd.zip
Fix `releases-tab` position on repo with "settings" in their na… (#2866)
Diffstat (limited to 'source/libs/utils.ts')
-rw-r--r--source/libs/utils.ts8
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(',');
+}