Add missing CSS_ATTRIBUTE_START case in SafeHtmlTemplates code generator. Review at: http://gwt-code-reviews.appspot.com/1395803 git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9914 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java b/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java index 9d32481..479dac5 100644 --- a/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java +++ b/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java
@@ -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 "
diff --git a/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java b/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java index e5b1615..28a4376 100644 --- a/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java +++ b/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java
@@ -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()); + } }