Debian Codegraph @

autoprefixer/lib/hacks/cross-fade.js

raw symbols SCIP
1 let list = require('postcss').list
2
3 let Value = require('../value')
4
5 class CrossFade extends Value {
6 replace(string, prefix) {
7 return list
8 .space(string)
9 .map(value => {
10 if (value.slice(0, +this.name.length + 1) !== this.name + '(') {
11 return value
12 }
13
14 let close = value.lastIndexOf(')')
15 let after = value.slice(close + 1)
16 let args = value.slice(this.name.length + 1, close)
17
18 if (prefix === '-webkit-') {
19 let match = args.match(/\d*.?\d+%?/)
20 if (match) {
21 args = args.slice(match[0].length).trim()
22 args += `, ${match[0]}`
23 } else {
24 args += ', 0.5'
25 }
26 }
27 return prefix + this.name + '(' + args + ')' + after
28 })
29 .join(' ')
30 }
31 }
32
33 CrossFade.names = ['cross-fade']
34
35 module.exports = CrossFade