# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: web/css/src/org/netbeans/modules/css/visual/ui/preview/CssPreviewGenerator.java --- web/css/src/org/netbeans/modules/css/visual/ui/preview/CssPreviewGenerator.java Base (1.7) +++ web/css/src/org/netbeans/modules/css/visual/ui/preview/CssPreviewGenerator.java Locally Modified (Based On 1.7) @@ -42,7 +42,9 @@ package org.netbeans.modules.css.visual.ui.preview; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; +import java.util.ListIterator; import java.util.StringTokenizer; import org.netbeans.modules.css.model.CssModel; import org.netbeans.modules.css.model.CssRule; @@ -84,7 +86,7 @@ //pseudo classes hack ( A:link { color: red; } //we need to generate an artificial element so we can spot various states of the element (a:visited, active etc.) //which depends on the state of the browser. - sb.append(rule.name().replace(':', 'X')); + sb.append(rule.name().replaceAll(":", "X"));//#118277 a:visited:hover sb.append(" {\n"); sb.append(rule.ruleContent().getFormattedString().replace('"', '\'')); @@ -107,8 +109,8 @@ } //pseudo classes ( A:link { color: red; } - int colonIndex = ruleName.indexOf(':'); - if(colonIndex > 0) { + int firstColonIndex = ruleName.indexOf(':'); + if(firstColonIndex > 0) { //the colon in the styles has been replaced by 'X' character //so to properly render the style we need to inherit the style form the selector //to do this - put the element generated from the pseudo class element by @@ -120,27 +122,39 @@ // //which will show the same result as if the link is visited in the browser - String selector = ruleName.substring(0, colonIndex); - String pseudoclass = ruleName.substring(colonIndex + 1, ruleName.length()); + String selector = ruleName.substring(0, firstColonIndex); + List pseudoclass = new ArrayList(2); + int colonIndex = ruleName.indexOf(':', firstColonIndex + 1); + String realName; + while (colonIndex > 0){ + realName = ruleName.substring(firstColonIndex + 1, colonIndex); + pseudoclass.add(realName.replaceAll(":", "X")); + colonIndex = ruleName.indexOf(':', colonIndex + 1); + } + realName = ruleName.substring(firstColonIndex + 1, ruleName.length()); + pseudoclass.add(realName.replaceAll(":", "X")); preview.append("<"); preview.append(selector); preview.append(">"); - + for (String pseudoclassName : pseudoclass) { preview.append("<"); preview.append(selector); preview.append('X'); - preview.append(pseudoclass); + preview.append(pseudoclassName); preview.append(">"); - + } preview.append(SAMPLE_TEXT); + ListIterator iter = pseudoclass.listIterator(pseudoclass.size()); + while (iter.hasPrevious()){// reverse order + String pseudoclassName = iter.previous(); preview.append(""); - + } preview.append("");