trusted-types icon indicating copy to clipboard operation
trusted-types copied to clipboard

Handle innerHTML of svg in IE

Open Siegrift opened this issue 5 years ago • 0 comments

One common pattern that frontend frameworks share is the way they solve a bug in IE, where there is no innerHTML of svg elements. Frameworks usually solve this in a similar way by creating a div container and using it's innerHTML property (e.g React implementation).

This breaks under TT, but it's only a very limited case and frameworks might not want to create a policy just for this (e.g. React). Furthermore, this behavior is only present on IE, which will have TT only via polyfill.

I think we can define the innerHTML of and svg element to resolve this issue. The usual way frameworks check for it is by checking 'innerHTML' in svgNode, which would evaulate to true and normal assignment would take place and we could use the same checks as we do for innerHTML of other elements. I am not 100% sure it would work, but it seems a good thing to do.

Siegrift avatar Sep 26 '19 19:09 Siegrift