MCPcopy Create free account
hub / github.com/ampproject/amphtml / doScopeSelector

Function doScopeSelector

third_party/webcomponentsjs/ShadowCSS.js:176–191  ·  view source on GitHub ↗
(selector, scopeSelector, opt_transformer)

Source from the content-addressed store, hash-verified

174}
175
176export function doScopeSelector(selector, scopeSelector, opt_transformer) {
177 var r = [], parts = selector.split(',');
178 parts.forEach(function(p) {
179 p = p.trim();
180 if (opt_transformer) {
181 p = opt_transformer(p);
182 }
183 if (selectorNeedsScoping(p, scopeSelector)) {
184 p = (strictStyling && !p.match(polyfillHostNoCombinator)) ?
185 applyStrictSelectorScope(p, scopeSelector) :
186 applySelectorScope(p, scopeSelector);
187 }
188 r.push(p);
189 });
190 return r.join(', ');
191}
192
193export function selectorNeedsScoping(selector, scopeSelector) {
194 if (allowArraySelectors && Array.isArray(scopeSelector)) {

Callers 1

scopeRulesFunction · 0.85

Calls 5

selectorNeedsScopingFunction · 0.85
applyStrictSelectorScopeFunction · 0.85
applySelectorScopeFunction · 0.85
forEachMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected