Well, three things: - There's an impedance mismatch between UiBinder (using XML with namespaces) and HTML. UiBinder has not been designed to output "namespaced HTML", and actually there's no such thing as "namespaced HTML" (SVG-in-HTML hardcodes the "xlink:href" name to translate to an "href" attribute in the XLink namespace in the InfoSet: https://html.spec.whatwg.org/multipage/syntax.html#adjust-foreign-attributes). To have UiBinder play well in those cases, it'd have to somehow follow the "InfoSet to HTML syntax" rules: https://html.spec.whatwg.org/multipage/syntax.html#serialising-html-fragments - UiBinder should probably converge to use jsilver's HtmlUtils.isAttributeUri and co. so we at least have the same rule everywhere. - JSilver should adjust to those special cases like "xhtml:href", and UiBinder should pass the appropriate name to JSilver (following the same "InfoSet to HTML syntax" mapping rules).
That doesn't look like an big effort (though too late for 2.8 I'm afraid…) On Wednesday, November 18, 2015 at 3:49:03 PM UTC+1, Stephen Haberman wrote: > > I'm attempting to use icons in an svg file in a ui.xml file like: > > <svg><use xlink:href=/icons.svg#foo-icon /></svg> > > But with a variable, so: > > <svg><use xlink:href="{someExpression}" /></svg> > > However, because of the xlink namespace (which the browser requires, > AFAICT), UiBinder and SafeHtml end up disagreeing on whether this is a > SafeUri-requiring attribute. > > E.g. here is the UiBinder logic, which ignores namespace because it uses > local name: > > > https://github.com/gwtproject/gwt/blob/master/user/src/com/google/gwt/uibinder/elementparsers/HtmlInterpreter.java#L48 > > And here is the SafeHtml logic, which does looks at namespace+attribute > due to the underlying jsilver implementation: > > > https://github.com/gwtproject/gwt/blob/master/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java#L301 > > > https://code.google.com/p/jsilver/source/browse/trunk/src/com/google/streamhtmlparser/impl/HtmlParserImpl.java#237 > > So, it ends up failing because UiBinder generated SafeUri, but SafeHtml > says "this attribute shouldn't be a SafeUri, did you SafeHtml or String". > > I'm wondering how to make them agree...while in this scenario it is true > that xlink:href is a URI, so UiBinder was right, in theory there could be > other namespaces where that is not the case, and the heuristic of "any > attribute named href is a uri, regardless of namespace" could be wrong. > > Any great ideas? > > ...I suppose the other option is to just turn off safe html templates for > now. > > - Stephen > > > > -- You received this message because you are subscribed to the Google Groups "GWT Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/15c92aa1-5e1f-49f1-8997-2d60db6d6505%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.