6
6
7
7
no-wrap = unquote ('nowrap' )
8
8
9
- /*
10
- * Helper to find out is the list of arguments have commas
11
- */
12
-
13
- is-comma-list ()
14
- return match ('\), \(' , '' + arguments )
15
-
16
- /*
17
- * Helper to find out if a given value is a width
18
- */
19
-
20
- is-width (val )
21
- if auto == val
22
- return true
23
- else if val && 'unit' == type (val )
24
- // Stylus does not short circuit so we need to perform this as a distinct
25
- // operation to prevent errors
26
- return '' != unit (val )
27
- return false
28
-
29
- /*
30
- * Literal joining
31
- */
32
-
33
- literal-join (string , literals )
34
- result = unquote ('' )
35
- first = true
36
- for args in literals
37
- subresult = unquote ('' )
38
- for arg in args
39
- subresult = subresult arg
40
- if first
41
- result = subresult
42
- first = false
43
- else
44
- result = s ('%s%s%s' , result , unquote (string ), subresult )
45
- return result
46
-
47
- /*
48
- * Modify matched arguments
49
- * set strict to false to check as “begin with”
50
- */
51
-
52
- modify-args (args , argument , prefix = '' , postfix = '' , replace = false , strict = true )
53
- result = ()
54
- argument = unquote (argument ) if type (argument ) == 'string'
55
- prefix = unquote (prefix )
56
- postfix = unquote (postfix )
57
-
58
- // Checking if there are values divided by comma
59
- if is- comma-list (args )
60
- for subargs in args
61
- subresult = ()
62
- for arg in subargs
63
- if (arg == argument and strict ) or (match ('' + s ('%s' ,argument ),'' + arg ) and ! strict )
64
- arg = s ('%s%s%s' , prefix , replace ? replace : arg , postfix )
65
- push (subresult , arg ) if arg != unquote ('' )
66
- subresult = literal-join (' ' , subresult ) if length (subresult ) > 1
67
- push (result , subresult )
68
- result = literal-join (', ' , result )
69
- else
70
- for arg in args
71
- if (arg == argument and strict ) or (match ('' + s ('%s' ,argument ),'' + arg ) and ! strict )
72
- arg = s ('%s%s%s' , prefix , replace ? replace : arg , postfix )
73
- push (result , arg ) if arg != unquote ('' )
74
- return result
75
-
76
- remove-args (args , argument , strict = true )
77
- return modify-args (args , argument , replace : unquote ('' ), strict : strict )
78
-
79
9
/*
80
10
* Vendor support for the given prop / arguments,
81
11
* optionally specifying the only prefixes to utilize,
@@ -91,22 +21,18 @@ vendor(prop, args, only = null, ignore = null, vendor-property = true)
91
21
newargs = args
92
22
93
23
// Transforms in transitions need the prefixes
94
- if prop in ('transition' 'transition-property' )
95
- newargs = modify-args (newargs , transform , '-' + prefix + '-' )
96
-
97
- // Adding prefixes for gradients
98
- if prop in ('border-image' 'background' 'background-image' 'cursor' 'list-style' 'list-style-image' )
99
- newargs = modify-args (newargs , "-gradient\(" , '-' + prefix + '-' , strict : false )
24
+ // if prop in ('transition' 'transition-property')
25
+ // newargs = modify-args(newargs, transform, '-' + prefix + '-')
100
26
101
27
// Removing the `fill` from prefixed border-images
102
- if prop in ('border-image' 'border-image-slice' )
103
- newargs = remove-args (newargs , fill )
28
+ // if prop in ('border-image' 'border-image-slice')
29
+ // newargs = remove-args(newargs, fill)
104
30
105
31
newprop = prop
106
32
newprop = '-' + prefix + '-' + prop if vendor-property
107
33
// TODO: make the adjustments for differences
108
34
// between the official syntax and vendor ones
109
- { newprop } : vendorize (newargs )
35
+ { newprop } : vendorize (prop ,( '%s' % args ), prefix )
110
36
111
37
/*
112
38
* Vendorize the given value.
0 commit comments