htmlToElements

Convert html source text to dom elements.

이 스크립트는 직접 설치하는 용도가 아닙니다. 다른 스크립트에서 메타 지시문 // @require https://updategreasyfork.deno.dev/scripts/410153/919984/htmlToElements.js을(를) 사용하여 포함하는 라이브러리입니다.

// ==UserScript==
// @name          htmlToElements
// @namespace     https://gf.zukizuki.org
// @version       0.1.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;
};