Author: nbelaevski
Date: 2007-05-21 16:57:41 -0400 (Mon, 21 May 2007)
New Revision: 208
Modified:
trunk/framework/src/main/java/org/ajax4jsf/framework/renderer/compiler/ClassElement.java
trunk/framework/src/main/java/org/ajax4jsf/framework/util/style/CSSFormat.java
Log:
Escapement in url() implemented
Modified:
trunk/framework/src/main/java/org/ajax4jsf/framework/renderer/compiler/ClassElement.java
===================================================================
---
trunk/framework/src/main/java/org/ajax4jsf/framework/renderer/compiler/ClassElement.java 2007-05-19
00:39:22 UTC (rev 207)
+++
trunk/framework/src/main/java/org/ajax4jsf/framework/renderer/compiler/ClassElement.java 2007-05-21
20:57:41 UTC (rev 208)
@@ -27,6 +27,7 @@
import javax.faces.FacesException;
import org.ajax4jsf.framework.util.message.Messages;
+import org.ajax4jsf.framework.util.style.CSSFormat;
import org.xml.sax.SAXException;
/**
@@ -38,8 +39,6 @@
private String _name;
- private static final String[] url = { "url(", ")" };
-
/*
* (non-Javadoc)
*
@@ -97,12 +96,10 @@
string.append(" ");
boolean isUrl = element instanceof ResourceElement;
if (isUrl) {
- string.append(url[0]);
+ string.append(CSSFormat.url(str));
+ } else {
+ string.append(str);
}
- string.append(str);
- if (isUrl) {
- string.append(url[1]);
- }
}
}
}
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/util/style/CSSFormat.java
===================================================================
---
trunk/framework/src/main/java/org/ajax4jsf/framework/util/style/CSSFormat.java 2007-05-19
00:39:22 UTC (rev 207)
+++
trunk/framework/src/main/java/org/ajax4jsf/framework/util/style/CSSFormat.java 2007-05-21
20:57:41 UTC (rev 208)
@@ -49,7 +49,8 @@
*/
public static String url(String url){
StringBuffer buf = new StringBuffer(url.length() + 7);
- buf.append("url(").append(url).append(")");
+ //escape url according to
http://www.w3.org/TR/REC-CSS1#url
+ buf.append("url(").append(url.replaceAll("([\\)\\(\\s,\'\"])",
"\\\\$1")).append(")");
return buf.toString();
}
/**