Permalink
Browse files

fix multiple selectors

  • Loading branch information...
aeosynth committed Feb 11, 2011
1 parent 7092127 commit ccae5dd798de6b197f326ba79047cff1b887c4c5
Showing with 12 additions and 3 deletions.
  1. +8 −2 lib/ccss.js
  2. +4 −1 src/ccss.coffee
View
@@ -9,7 +9,7 @@ extend = function(object, properties) {
return object;
};
this.compile = function(rules) {
- var css, declarations, key, mixin, mixins, nested, pairs, selector, value, _i, _len, _ref;
+ var child, children, css, declarations, key, mixin, mixins, nested, pairs, selector, split, value, _i, _j, _len, _len2, _ref;
css = '';
for (selector in rules) {
pairs = rules[selector];
@@ -26,7 +26,13 @@ this.compile = function(rules) {
for (key in pairs) {
value = pairs[key];
if (typeof value === 'object') {
- nested["" + selector + " " + key] = value;
+ children = [];
+ split = key.split(/\s*,\s*/);
+ for (_j = 0, _len2 = split.length; _j < _len2; _j++) {
+ child = split[_j];
+ children.push("" + selector + " " + child);
+ }
+ nested[children.join(',')] = value;
} else {
key = key.replace(/[A-Z]/g, function(s) {
return '-' + s.toLowerCase();
View
@@ -21,7 +21,10 @@ extend = (object, properties) ->
#a pair is either a css declaration, or a nested rule
for key, value of pairs
if typeof value is 'object'
- nested["#{selector} #{key}"] = value
+ children = []
+ split = key.split /\s*,\s*/
+ children.push "#{selector} #{child}" for child in split
+ nested[children.join ','] = value
else
#borderRadius -> border-radius
key = key.replace /[A-Z]/g, (s) -> '-' + s.toLowerCase()

0 comments on commit ccae5dd

Please sign in to comment.