MCPcopy Index your code
hub / github.com/postcss/autoprefixer / reduceSpaces

Method reduceSpaces

lib/processor.js:577–605  ·  view source on GitHub ↗

* Normalize spaces in cascade declaration group

(decl)

Source from the content-addressed store, hash-verified

575 * Normalize spaces in cascade declaration group
576 */
577 reduceSpaces(decl) {
578 let stop = false
579 this.prefixes.group(decl).up(() => {
580 stop = true
581 return true
582 })
583 if (stop) {
584 return
585 }
586
587 let parts = decl.raw('before').split('\n')
588 let prevMin = parts[parts.length - 1].length
589 /** @type {number|false} */
590 let diff = false
591
592 this.prefixes.group(decl).down(other => {
593 parts = other.raw('before').split('\n')
594 let last = parts.length - 1
595
596 if (parts[last].length > prevMin) {
597 if (diff === false) {
598 diff = parts[last].length - prevMin
599 }
600
601 parts[last] = parts[last].slice(0, -diff)
602 other.raws.before = parts.join('\n')
603 }
604 })
605 }
606
607 /**
608 * Remove unnecessary pefixes

Callers 1

removeMethod · 0.95

Calls 3

upMethod · 0.80
groupMethod · 0.80
downMethod · 0.80

Tested by

no test coverage detected