On Monday, March 4, 2013 10:35:11 AM UTC+1, Ignacio Baca Moreno-Torres
wrote:
>
> But did you transform the string to a safeStyle using SafeStyleUtils?
>
> I test this with no warnings…
> interface Template extends SafeHtmlTemplates {
> @Template("<span style=\"{0}\">...</span>")
> SafeHtml span(SafeStyles value);
> }
> RootPanel.get().add(new HTML(template
> .span(SafeStylesUtils.fromTrustedString("background: red;"))));
>
The issue is with UiBinder; SafeStyles obviously work OK with
SafeHtmlTemplates (they're almost useless without it).
The problem is that UiBinder requires a String value for all HTML
attributes, and then it generates a SafeHtmlTemplates, and the HTML parser
used by the SafeHtmlTemplate generator knows which attribute accepts URLs
or CSS, and warns if their values are not SafeUri or SafeStyles
respectively.
So, UiBinder forces you to use a String, and generates a SafeHtmlTemplates
that warns you that you don't use a SafeStyles.
@Enrique: please file an issue: UiBinder should at least accept SafeStyles
in attributes, and then let the generated SafeHtmlTemplate warn or fail if
used in inappropriate places.
Actually, this is already done for SafeUri in GWT 2.5, and needs to be done
for SafeStyles (see
https://code.google.com/p/google-web-toolkit/source/detail?r=10548 which
explicitly says "Similar will be needed for SafeStyles.")
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.