UNPKG

@squirrel-forge/ui-util

Version:

A collection of utilities, classes, functions and abstracts made for the browser and babel compatible.

18 lines (16 loc) 442 B
/** * Requires */ import { str2node } from '../String/str2node.js'; /** * Append HTML string as one or multiple elements * @param {HTMLElement} element - Element to append to * @param {string} str - HTML string to append * @return {void} */ export function appendHTML( element, str ) { const children = str2node( str, true ); for ( let i = 0; i < children.length; i++ ) { element.appendChild( children[ i ] ); } }