Skip to content
This repository
Browse code

Applying linear-gradient to border-image; fixes #19

  • Loading branch information...
commit d422aa701c835cbe0e6ccf7c6299eedf4efa67a9 1 parent c5bfee1
Roman Komarov authored May 18, 2012 slang800 committed July 29, 2013

Showing 1 changed file with 11 additions and 6 deletions. Show diff stats Hide diff stats

  1. 17  lib/nib/vendor.styl
17  lib/nib/vendor.styl
@@ -45,24 +45,27 @@ literal-join(string, literals)
45 45
   return result
46 46
 
47 47
 /*
48  
- * Replacing one value with another
  48
+ * Prepend matched argument with given prefix
  49
+ * set strict to false to check as “begin with”
49 50
  */
50 51
 
51  
-replace-args(args,argument,val)
  52
+prepend-args(args, prefix, argument, strict = true)
52 53
   result = ()
53 54
   // Checking if there are values divided by comma
54 55
   if is-comma-list(args)
55 56
     for subargs in args
56 57
       subresult = ()
57 58
       for arg in subargs
58  
-        arg = unquote(val) if arg == argument
  59
+        if (arg == argument and strict) or (match('^'+s('%s',argument),''+arg) and !strict)
  60
+          arg = s('%s%s',unquote(prefix),arg)
59 61
         push(subresult, arg)
60 62
       subresult = literal-join(' ', subresult) if length(subresult) > 1
61 63
       push(result, subresult)
62 64
     result = literal-join(', ', result)
63 65
   else
64 66
     for arg in args
65  
-      arg = unquote(val) if arg == argument
  67
+      if (arg == argument and strict) or (match('^'+s('%s',argument),''+arg) and !strict)
  68
+        arg = s('%s%s',unquote(prefix),arg)
66 69
       push(result, arg)
67 70
   return result
68 71
 
@@ -81,7 +84,9 @@ vendor(prop, args, only = null, ignore = null)
81 84
         newargs = args
82 85
         // Adjusting the args if needed
83 86
         if prop in ('transition' 'transition-property')
84  
-          newargs = replace-args(args, transform, '-' + prefix + '-transform')
  87
+          newargs = prepend-args(args, '-' + prefix + '-', transform)
  88
+        if prop in ('border-image')
  89
+          newargs = prepend-args(args, '-' + prefix + '-', linear-gradient, false)
85 90
         {'-' + prefix + '-' + prop}: newargs
86 91
 
87 92
 /*
@@ -578,4 +583,4 @@ placeholder()
578 583
           pair()
579 584
         else if pair is not null && pair[0] is not null
580 585
           {pair[0]}: type(pair[1]) == 'string' ? s(pair[1]) : pair[1]
581  
-input-placeholder = placeholder
  586
+input-placeholder = placeholder

0 notes on commit d422aa7

Please sign in to comment.
Something went wrong with that request. Please try again.