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:
And here is the SafeHtml logic, which does looks at namespace+attribute due to the underlying jsilver implementation:
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