source: node_modules/autoprefixer/lib/hacks/cross-fade.js@ 2058e5c

Last change on this file since 2058e5c was 2058e5c, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Working / before login

  • Property mode set to 100644
File size: 863 bytes
RevLine 
[2058e5c]1let list = require('postcss').list
2
3let Value = require('../value')
4
5class 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
33CrossFade.names = ['cross-fade']
34
35module.exports = CrossFade
Note: See TracBrowser for help on using the repository browser.