如何将Element innerHtml更改为Dart SDK 0.7.1

Tua*_*Anh 4 dart dart-webui

我正在使用dart-message https://github.com/mkozhukh/dart-message.它有功能......

MessageBox(String text, String header, String css){
    _box = new DivElement();
    ...
    _box.onClick.listen(_clickHandler);

    if (header != null)
      html.write("<div class='dhtmlx_popup_title'>$header</div>");
    html.write("<div class='dhtmlx_popup_text'><span>$text</span></div>");
    html.write("<div class='dhtmlx_popup_controls'>");
  }

String addButton(String text, String result){
    if (html != null){
      html.write("<div class='dhtmlx_popup_button' result='$result' ><div>$text</div></div>");
    } else
      throw new Exception(".addButton must be used before .show"); 
  }

 _clickHandler(Event event){
    String result = event.target.attributes["result"];
    if (result == null)
      result = event.target.parent.attributes["result"];
    hide(result); //<=== ERROR result alway return null
  }
Run Code Online (Sandbox Code Playgroud)

Future<String> show(){
    if (html != null){
      //finalize html initialization
      html.write("</div>");
      _box.innerHtml = html.toString();  //<===== ERROR after line : Removing disallowed attribute <DIV result="ok">
      html = null;
    }
...
}
Run Code Online (Sandbox Code Playgroud)

...

如何将此代码更改为SDK 0.7.1.非常感谢你.

Tua*_*Anh 7

我换了代码

_box.innerHtml = html.toString();
Run Code Online (Sandbox Code Playgroud)

==>

_box.setInnerHtml(html.toString(), treeSanitizer : new NullTreeSanitizer());
Run Code Online (Sandbox Code Playgroud)

它的工作原理.