MCPcopy Index your code
hub / github.com/darkreader/darkreader / getTokenExclusionRanges

Function getTokenExclusionRanges

src/utils/css-text/parse-css.ts:81–90  ·  view source on GitHub ↗
(cssText: string)

Source from the content-addressed store, hash-verified

79}
80
81function getTokenExclusionRanges(cssText: string) {
82 const singleQuoteGoesFirst = cssText.indexOf("'") < cssText.indexOf('"');
83 const firstQuote = singleQuoteGoesFirst ? "'" : '"';
84 const secondQuote = singleQuoteGoesFirst ? '"' : "'";
85 const excludeRanges: TextRange[] = getAllOpenCloseRanges(cssText, firstQuote, firstQuote);
86 excludeRanges.push(...getAllOpenCloseRanges(cssText, secondQuote, secondQuote, excludeRanges));
87 excludeRanges.push(...getAllOpenCloseRanges(cssText, '[', ']', excludeRanges));
88 excludeRanges.push(...getAllOpenCloseRanges(cssText, '(', ')', excludeRanges));
89 return excludeRanges;
90}
91
92function parseSelectors(selectorText: string) {
93 const excludeRanges = getTokenExclusionRanges(selectorText);

Callers 3

parseCSSFunction · 0.85
parseSelectorsFunction · 0.85
parseDeclarationsFunction · 0.85

Calls 1

getAllOpenCloseRangesFunction · 0.85

Tested by

no test coverage detected