function createDocumentFragment(txt) {
const template = <div class='child'>${txt}</div>
;
let frag = document.createRange().createContextualFragment(template);
return frag;
}
const container = document.getElementById('container');
container.appendChild(createDocumentFragment('hello'));
网友评论