Closed mikesamuel closed 4 years ago
Simple test for viewBox:
PolicyFactory policyFactory = new HtmlPolicyBuilder()
.allowElements("svg")
.allowAttributes("viewBox").onElements("svg")
.toFactory();
String svg = "<svg viewBox=\"0 0 0 0\"></svg>";
assertEquals(svg, policyFactory.sanitize(svg));
@zeeneir Added tests. Let me know if this PR solves your problem.
Looks good to me. Thanks a lot!
…s exactly
This commit splits HtmlLexer.canonicalName into variants which preserve items on whitelists derived from the SVG and MathML specifications, and adjusts callers of canonicalName to use the appropriate variant.
Fixes #182
@wookie41 @zeeneir do you have an example that I can turn into a unit test?