MCPcopy
hub / github.com/postcss/postcss / walkRules

Method walkRules

lib/container.js:381–403  ·  view source on GitHub ↗
(selector, callback)

Source from the content-addressed store, hash-verified

379 }
380
381 walkRules(selector, callback) {
382 if (!callback) {
383 callback = selector
384
385 return this.walk((child, i) => {
386 if (child.type === 'rule') {
387 return callback(child, i)
388 }
389 })
390 }
391 if (selector instanceof RegExp) {
392 return this.walk((child, i) => {
393 if (child.type === 'rule' && selector.test(child.selector)) {
394 return callback(child, i)
395 }
396 })
397 }
398 return this.walk((child, i) => {
399 if (child.type === 'rule' && child.selector === selector) {
400 return callback(child, i)
401 }
402 })
403 }
404}
405
406Container.registerParse = dependant => {

Callers 3

processor.test.tsFile · 0.80
map.test.tsFile · 0.80
container.test.tsFile · 0.80

Calls 1

walkMethod · 0.95

Tested by

no test coverage detected