diff options
author | Marc Englund <marc@vaadin.com> | 2012-11-21 17:03:08 +0200 |
---|---|---|
committer | Marc Englund <marc@vaadin.com> | 2012-11-21 17:03:08 +0200 |
commit | 044fa4167edf5d0f48357679712eefda5602d6f9 (patch) | |
tree | 63dc81b57fe982d8f3c6bf522309342f7cbf8aa4 /theme-compiler | |
parent | 6ed87c1b6ce280082c2dee21a6f87c1620e0ea79 (diff) | |
download | vaadin-framework-044fa4167edf5d0f48357679712eefda5602d6f9.tar.gz vaadin-framework-044fa4167edf5d0f48357679712eefda5602d6f9.zip |
Fixes #10308 (parent reference & causes non-parent selectors to be dropped)
Change-Id: I4821d14b4dc2a9e83e6fbfba67d39e0e3e98970f
Diffstat (limited to 'theme-compiler')
3 files changed, 31 insertions, 9 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java b/theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java index cb7b0ac8a8..6b5c5538a4 100644 --- a/theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java +++ b/theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java @@ -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(); diff --git a/theme-compiler/tests/resources/css/parent-selector.css b/theme-compiler/tests/resources/css/parent-selector.css index e7e37e92ab..1aa389f593 100644 --- a/theme-compiler/tests/resources/css/parent-selector.css +++ b/theme-compiler/tests/resources/css/parent-selector.css @@ -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 diff --git a/theme-compiler/tests/resources/scss/parent-selector.scss b/theme-compiler/tests/resources/scss/parent-selector.scss index 68f66a4a27..c0ef46afb3 100644 --- a/theme-compiler/tests/resources/scss/parent-selector.scss +++ b/theme-compiler/tests/resources/scss/parent-selector.scss @@ -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 |