Permalink
Browse files

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

  • Loading branch information...
1 parent c5bfee1 commit d422aa701c835cbe0e6ccf7c6299eedf4efa67a9 @kizu kizu committed with slang800 May 17, 2012
Showing with 11 additions and 6 deletions.
  1. +11 −6 lib/nib/vendor.styl
View
17 lib/nib/vendor.styl
@@ -45,24 +45,27 @@ literal-join(string, literals)
return result
/*
- * Replacing one value with another
+ * Prepend matched argument with given prefix
+ * set strict to false to check as “begin with”
*/
-replace-args(args,argument,val)
+prepend-args(args, prefix, argument, strict = true)
result = ()
// Checking if there are values divided by comma
if is-comma-list(args)
for subargs in args
subresult = ()
for arg in subargs
- arg = unquote(val) if arg == argument
+ if (arg == argument and strict) or (match('^'+s('%s',argument),''+arg) and !strict)
+ arg = s('%s%s',unquote(prefix),arg)
push(subresult, arg)
subresult = literal-join(' ', subresult) if length(subresult) > 1
push(result, subresult)
result = literal-join(', ', result)
else
for arg in args
- arg = unquote(val) if arg == argument
+ if (arg == argument and strict) or (match('^'+s('%s',argument),''+arg) and !strict)
+ arg = s('%s%s',unquote(prefix),arg)
push(result, arg)
return result
@@ -81,7 +84,9 @@ vendor(prop, args, only = null, ignore = null)
newargs = args
// Adjusting the args if needed
if prop in ('transition' 'transition-property')
- newargs = replace-args(args, transform, '-' + prefix + '-transform')
+ newargs = prepend-args(args, '-' + prefix + '-', transform)
+ if prop in ('border-image')
+ newargs = prepend-args(args, '-' + prefix + '-', linear-gradient, false)
{'-' + prefix + '-' + prop}: newargs
/*
@@ -578,4 +583,4 @@ placeholder()
pair()
else if pair is not null && pair[0] is not null
{pair[0]}: type(pair[1]) == 'string' ? s(pair[1]) : pair[1]
-input-placeholder = placeholder
+input-placeholder = placeholder

0 comments on commit d422aa7

Please sign in to comment.