Convert html source text to dom elements.
目前為
此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/410153/842393/htmlToElements.js
// ==UserScript==
// @name htmlToElements
// @namespace https://github.com
// @version 0.1
// @description Convert html source text to dom elements.
// @match *://*/*
// @grant none
// ==/UserScript==
/**
* https://stackoverflow.com/a/35385518
* @param {String} HTML representing any number of sibling elements
* @return {NodeList}
*/
const htmlToElements = (htmlSrc) => {
let template = document.createElement('template');
template.innerHTML = htmlSrc;
return template.content;
};