Browse files

Fixes #819 Extends generate duplicate selectors

  • Loading branch information...
1 parent b4c438d commit 5d6eba4d0a26d3c917785624423ab183876cc6ca @tonistiigi committed Oct 23, 2012
Showing with 20 additions and 2 deletions.
  1. +4 −2 lib/visitor/normalizer.js
  2. +6 −0 test/cases/regression.819.css
  3. +10 −0 test/cases/regression.819.styl
View
6 lib/visitor/normalizer.js
@@ -215,8 +215,10 @@ Normalizer.prototype.extend = function(group, selectors){
node.val = selector;
node.inherits = false;
groups.forEach(function(group){
- self.extend(group, selectors);
- group.push(node);
+ if (!group.nodes.some(function(n){ return n.val == selector })) {
+ self.extend(group, selectors);
+ group.push(node);
+ }
});
});
});
View
6 test/cases/regression.819.css
@@ -0,0 +1,6 @@
+.bar,
+.foo,
+.baz,
+.baz > li {
+ prop: val;
+}
View
10 test/cases/regression.819.styl
@@ -0,0 +1,10 @@
+.bar
+ prop val
+
+.foo
+ @extend .bar
+
+.baz
+ &,
+ > li
+ @extend .foo

0 comments on commit 5d6eba4

Please sign in to comment.