I have the following element created by UiBinder:
@UiField UListElement phones;
With the following markup:
<ul ui:field="phones" class="contact section"></ul>
I had previously been using the method setInnerHtml(String) to set the value. For example:
phones.setInnerHtml("<li><span class='title'>" + title +
"</span><div class='phone'><a href='tel:" + number + "'>" +
number + "</a></div></li>");
I would now like to use SafeHtmlTemplates to reduce the possibility of having XSS (cross-site scripting) problems. Using a SafeHtmlTemplate, I now get back SafeHtml which I would like to stick into my phones element variable. How do I do this? I don’t see a method that would take a SafeHtml type variable.
To use
SafeHtmlyou have to stick to GWTs widgets. More specific:If Ui:Binder should generate safe html you have to set the following property in your module xml: