I've encountered the following problem:
Before mods may click 'duplicate', it isn't. I've searched the problem, found 'solutions', applied 'solutions' and they didn't work. So the question could be 'Why is my 'solution' not working?' or the question could be 'What is the actual solution?'
The responsible code for this is
querySelector("#element").setInnerHtml(some_element.outerHtml, treeSanitizer: NodeTreeSanitizer.trusted);
I found out to apply the sanitizer to the Element.
Element element = new Element.html('<a data-tag="value">thing</a>'), treeSanitizer: NodeTreeSanitizer.trusted)