Revision: 9914
Author: x...@google.com
Date: Tue Mar 29 14:59:28 2011
Log: Add missing CSS_ATTRIBUTE_START case in SafeHtmlTemplates code
generator.
Review at: http://gwt-code-reviews.appspot.com/1395803
http://code.google.com/p/google-web-toolkit/source/detail?r=9914
Modified:
/trunk/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java
/trunk/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java
=======================================
---
/trunk/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java
Thu Mar 3 13:21:55 2011
+++
/trunk/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java
Tue Mar 29 14:59:28 2011
@@ -245,6 +245,7 @@
break;
case CSS_ATTRIBUTE:
+ case CSS_ATTRIBUTE_START:
// TODO(xtof): Improve support for CSS.
logger.log(TreeLogger.WARN, "Template with variable in CSS
context: "
+ "The template code generator cannot guarantee HTML-safety
of "
=======================================
---
/trunk/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java
Thu Dec 9 08:34:53 2010
+++
/trunk/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java
Tue Mar 29 14:59:28 2011
@@ -62,6 +62,9 @@
@Template("<span><img src=\"{0}/{1}\"/></span>")
SafeHtml templateWithTwoPartUriAttribute(String baseUrl, String
urlPart);
+
+ @Template("<span style='{0}; color: green;'></span>")
+ SafeHtml templateWithStyleAttribute(String style);
}
public void testSimpleTemplate() {
@@ -107,4 +110,10 @@
templates.templateWithTwoPartUriAttribute(
BAD_URL, "x&y").asString());
}
-}
+
+ public void testTemplateWithStyleAttribute() {
+ Assert.assertEquals(
+ "<span style='background: purple; color: green;'></span>",
+ templates.templateWithStyleAttribute("background:
purple").asString());
+ }
+}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors