MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / find

Method find

src/common/style/CartoCSS.js:4334–4360  ·  view source on GitHub ↗
(selector, self)

Source from the content-addressed store, hash-verified

4332 }
4333
4334 find(selector, self) {
4335 self = self || this;
4336 var rules = [], match,
4337 key = selector.toString();
4338
4339 if (key in this._lookups) {
4340 return this._lookups[key];
4341 }
4342
4343 this.rulesets().forEach(function (rule) {
4344 if (rule !== self) {
4345 for (var j = 0; j < rule.selectors.length; j++) {
4346 match = selector.match(rule.selectors[j]);
4347 if (match) {
4348 if (selector.elements.length > 1) {
4349 Array.prototype.push.apply(rules, rule.find(
4350 new CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
4351 } else {
4352 rules.push(rule);
4353 }
4354 break;
4355 }
4356 }
4357 }
4358 });
4359 return this._lookups[key] = rules;
4360 }
4361
4362 // Zooms can use variables. This replaces CartoCSS.Tree.Zoom objects on selectors
4363 // with simple bit-arrays that we can compare easily.

Callers 15

callbackFunction · 0.45
WebMapV2Spec.jsFile · 0.45
WebMapV3Spec.jsFile · 0.45
WebMapV22Spec.jsFile · 0.45
callbackFunction · 0.45
WebMapV3Spec.jsFile · 0.45
getLayerFunction · 0.45
getLayerFunction · 0.45
MapFunction · 0.45

Calls 5

rulesetsMethod · 0.95
forEachMethod · 0.80
matchMethod · 0.80
pushMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected