Skip to content

Commit

Permalink
Preserving importance in augmented borders and border-radiuses, also …
Browse files Browse the repository at this point in the history
…removed legacy vendor support from border-radiuses, as we dont support them for simple one
  • Loading branch information
kizu committed Aug 24, 2012
1 parent 699be18 commit db6b9f9
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 29 deletions.
4 changes: 2 additions & 2 deletions lib/nib/border.styl
Expand Up @@ -4,8 +4,8 @@
* border: ...
*/

border(color)
border(color, args...)
if color is a 'color'
border: 1px solid color
border: 1px solid color args
else
border: arguments
19 changes: 11 additions & 8 deletions lib/nib/vendor.styl
Expand Up @@ -479,23 +479,24 @@ text-overflow()
* Helper for border-radius().
*/

-apply-border-radius(pos)
-apply-border-radius(pos, importance)
if length(pos) == 3
// border-radius: <top | buttom> <left | right> <n>
y = pos[0]
x = pos[1]
vendor('border-radius-%s%s' % pos, pos[2], only: moz)
vendor('border-%s-%s-radius' % pos, pos[2], ignore: moz)
// We don't use moz for simple boder-radius anymore
// vendor('border-radius-%s%s' % pos, pos[2], only: moz)
vendor('border-%s-%s-radius' % pos, pos[2] importance, only: webkit official)
else if pos[0] in (top bottom)
// border-radius: <top | bottom> <n>
-apply-border-radius(pos[0] left pos[1])
-apply-border-radius(pos[0] right pos[1])
-apply-border-radius(pos[0] left pos[1], importance)
-apply-border-radius(pos[0] right pos[1], importance)
else if pos[0] in (left right)
// border-radius: <left | right> <n>
unshift(pos, top);
-apply-border-radius(pos)
-apply-border-radius(pos, importance)
pos[0] = bottom
-apply-border-radius(pos)
-apply-border-radius(pos, importance)

/*
* border-radius supporting vendor prefixes and
Expand All @@ -515,6 +516,8 @@ text-overflow()
border-radius()
pos = ()
augmented = false
importance = arguments[length(arguments) - 1] == !important ? !important : unquote('')

for args in arguments
for arg in args
if arg is a 'ident'
Expand All @@ -523,6 +526,6 @@ border-radius()
else
append(pos, arg)
if augmented
-apply-border-radius(pos)
-apply-border-radius(pos, importance)
pos = ()
vendor('border-radius', pos, only: webkit official) unless augmented
3 changes: 2 additions & 1 deletion test/cases/border.css
@@ -1,5 +1,6 @@
.foo {
border: none;
border: 1px solid #f00;
border: 1px solid #0f0 !important;
border: 1px solid #f00;
}
}
3 changes: 2 additions & 1 deletion test/cases/border.styl
Expand Up @@ -4,4 +4,5 @@
.foo
border: none
border: red
border: 1px solid red
border: lime !important
border: 1px solid red
20 changes: 4 additions & 16 deletions test/cases/vendor.border-radius.css
Expand Up @@ -3,54 +3,42 @@ button {
border-radius: 1px 2px/3px 4px;
}
button {
-moz-border-radius-topleft: 10px;
-webkit-border-top-left-radius: 10px;
-o-border-top-left-radius: 10px;
-ms-border-top-left-radius: 10px;
border-top-left-radius: 10px;
}
button {
-moz-border-radius-bottomright: 5px;
-webkit-border-top-left-radius: 10px !important;
border-top-left-radius: 10px !important;
}
button {
-webkit-border-bottom-right-radius: 5px;
-o-border-bottom-right-radius: 5px;
-ms-border-bottom-right-radius: 5px;
border-bottom-right-radius: 5px;
}
button {
-moz-border-radius-topleft: 5px;
-webkit-border-top-left-radius: 5px;
border-top-left-radius: 5px;
-moz-border-radius-bottomright: 10px;
-webkit-border-bottom-right-radius: 10px;
border-bottom-right-radius: 10px;
}
button {
-moz-border-radius-bottomleft: 10px;
-webkit-border-bottom-left-radius: 10px;
border-bottom-left-radius: 10px;
-moz-border-radius-bottomright: 10px;
-webkit-border-bottom-right-radius: 10px;
border-bottom-right-radius: 10px;
}
button {
-moz-border-radius-topleft: 5px;
-webkit-border-top-left-radius: 5px;
border-top-left-radius: 5px;
-moz-border-radius-topright: 5px;
-webkit-border-top-right-radius: 5px;
border-top-right-radius: 5px;
-moz-border-radius-bottomleft: 10px;
-webkit-border-bottom-left-radius: 10px;
border-bottom-left-radius: 10px;
-moz-border-radius-bottomright: 10px;
-webkit-border-bottom-right-radius: 10px;
border-bottom-right-radius: 10px;
}
button {
-moz-border-radius-topleft: 5px;
-webkit-border-top-left-radius: 5px;
border-top-left-radius: 5px;
-moz-border-radius-bottomright: 10px;
-webkit-border-bottom-right-radius: 10px;
border-bottom-right-radius: 10px;
}
Expand Down
5 changes: 4 additions & 1 deletion test/cases/vendor.border-radius.styl
Expand Up @@ -7,6 +7,9 @@ button
button
border-radius: top left 10px

button
border-radius: top left 10px !important

button
border-radius: bottom right 5px

Expand All @@ -27,4 +30,4 @@ button
prepend(vendor-prefixes, ms, o)

button
border-radius: 5px
border-radius: 5px

0 comments on commit db6b9f9

Please sign in to comment.