DOMParser().parseFormString()
// case 1
let doc = new DOMParser().parseFromString('<p>123</p>', 'text/html')
console.log(doc)
// case 2
let doc = new DOMParser().parseFromString('<p>123</p>', 'text/xml')
console.log(doc)
document.createRange().createContextualFragment()
let frag = document.createRange().createContextualFragment('<div>One</div><div>Two</div>')
console.log(frag)
网友评论