Dart, why does using innerHtml to set shadow root content work but appendHtml doesn't?

别来无恙 提交于 2019-11-28 11:12:45

问题


I have made this Gist to show the issue but essentially I have found that using shadowRoot.innerHtml = '...' works but using shadowRoot.appendHtml('...') doesn't work, it causes the console warning Removing disallowed element <STYLE> which I can't explain. Anyone know if this is simple the way it is meant to be or is it specific to Dart?


回答1:


Removing disallowed element indicates that you need a NodeValidator.

shadowRoot.append(
    new document.body.createFragment('....'), 
    validator: new NodeValidationBuilder().allow(...);


来源:https://stackoverflow.com/questions/24000995/dart-why-does-using-innerhtml-to-set-shadow-root-content-work-but-appendhtml-do

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!