# html 字符串转 dom

html 字符串转 dom:

function htmlToElement(html) {
    var template = document.createElement('template');
    html = html.trim(); // 避免返回空文本 node 节点
    template.innerHTML = html;
    return template.content.firstChild;
}
最后更新: Sat, 15 Mar 2025 10:45:35 GMT

0 评论

加载中...
访问量:-
源码 | 反馈
注意:聊天日志不会保存,请注意备份.
提示:点击头像可进入私聊
发送