DOMParser appending [removed] tags to <head>/<body> but not executing

后端 未结 3 1253
傲寒
傲寒 2020-12-14 05:05

I\'m attempting to parse a string into a full HTML document via DOMParser and then overwrite the current page with the processed nodes. The string contains complete markup,

3条回答
  •  -上瘾入骨i
    2020-12-14 05:31

    You should use:

    const sHtml = '';
    const frag = document.createRange().createContextualFragment(sHtml)
    document.body.appendChild( frag );
    

提交回复
热议问题