(selector, self)
| 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. |
no test coverage detected