MCPcopy
hub / github.com/postcss/autoprefixer / replace

Method replace

lib/hacks/gradient.js:373–392  ·  view source on GitHub ↗

* Change degrees for webkit prefix

(string, prefix)

Source from the content-addressed store, hash-verified

371 * Change degrees for webkit prefix
372 */
373 replace(string, prefix) {
374 let ast = parser(string)
375 for (let node of ast.nodes) {
376 let gradientName = this.name // gradient name
377 if (node.type === 'function' && node.value === gradientName) {
378 node.nodes = this.newDirection(node.nodes)
379 node.nodes = this.normalize(node.nodes, gradientName)
380 if (prefix === '-webkit- old') {
381 let changes = this.oldWebkit(node)
382 if (!changes) {
383 return false
384 }
385 } else {
386 node.nodes = this.convertDirection(node.nodes)
387 node.value = prefix + node.value
388 }
389 }
390 }
391 return ast.toString()
392 }
393
394 /**
395 * Replace first token

Callers 15

insertMethod · 0.45
setMethod · 0.45
insertMethod · 0.45
normalizeMethod · 0.45
prefixedMethod · 0.45
prefixTrackPropFunction · 0.45
selectorMayOverlapFunction · 0.45
parseMediaParamsFunction · 0.45
setMethod · 0.45
normalizeMethod · 0.45
prefixedMethod · 0.45
setMethod · 0.45

Calls 4

newDirectionMethod · 0.95
normalizeMethod · 0.95
oldWebkitMethod · 0.95
convertDirectionMethod · 0.95

Tested by

no test coverage detected