]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes #10308 (parent reference & causes non-parent selectors to be dropped) 24/324/1
authorMarc Englund <marc@vaadin.com>
Wed, 21 Nov 2012 15:03:08 +0000 (17:03 +0200)
committerMarc Englund <marc@vaadin.com>
Wed, 21 Nov 2012 15:03:08 +0000 (17:03 +0200)
Change-Id: I4821d14b4dc2a9e83e6fbfba67d39e0e3e98970f

theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java
theme-compiler/tests/resources/css/parent-selector.css
theme-compiler/tests/resources/scss/parent-selector.scss

index cb7b0ac8a89ca5ed2c22355dcfe4347c0772348d..6b5c5538a4adad8cbcb2bffb7744acaac3301d4a 100644 (file)
@@ -32,18 +32,16 @@ public class ParentSelectorHandler {
             ArrayList<String> newList = new ArrayList<String>(block
                     .getSelectorList().size());
             BlockNode parentBlock = (BlockNode) parentNode;
-            for (final String s : block.getSelectorList()) {
-
-                if (s.contains("&")) {
-                    for (final String parentSelector : parentBlock
-                            .getSelectorList()) {
+            for (final String parentSelector : parentBlock.getSelectorList()) {
+                for (final String s : block.getSelectorList()) {
+                    if (s.contains("&")) {
                         newList.add(s.replace("&", parentSelector));
                         isParentSelector = true;
+                    } else {
+                        newList.add(parentSelector + " " + s);
                     }
-
                 }
             }
-
             if (isParentSelector) {
                 block.setSelectorList(newList);
                 Node oldparent = block.getParentNode();
index e7e37e92abedea301cc8ab95b2b0dc9e51dee158..1aa389f593c7519777c1d2b356a576caf937ec2d 100644 (file)
@@ -31,6 +31,14 @@ body.firefox a {
        color: blue;
 }
 
-.part.one, .part.two {
+.part.one, .part.two, .part .non-parent {
+       color: blue;
+}
+
+.root .part.one, .root .part .non-parent, .root .part2.one, .root .part2 .non-parent {
+       color: blue;
+}
+
+.root2 .part .one, .root2 .part .non-parent, .root2 .part2 .one, .root2 .part2 .non-parent {
        color: blue;
 }
\ No newline at end of file
index 68f66a4a2756693074d88c9afc78ee548905bebf..c0ef46afb3eb424d21aebce01652b2cf8ec88094 100644 (file)
@@ -27,7 +27,23 @@ a {
 }
 
 .part {
-       &.one, &.two {
+       &.one, &.two, .non-parent {
                color: blue;
        }
+}
+
+.root {
+       .part, .part2 {
+               &.one, .non-parent {
+                       color: blue;
+               }
+       }
+}
+
+.root2 {
+       .part, .part2 {
+               .one, .non-parent {
+                       color: blue;
+               }
+       }
 }
\ No newline at end of file