@ungap/create-content
v0.3.1
Published
A cross browser utility to create HTML or SVG runtime content
Downloads
30,194
Maintainers
Readme
createContent
A cross browser utility to create HTML or SVG runtime content, as lightweight alternative to what a HTMLTemplateElement polyfill could do through its content
accessor.
- CDN global utility via https://unpkg.com/@ungap/create-content
- ESM via
import createContent from '@ungap/create-content'
- CJS via
const createContent = require('@ungap/create-content')
Example
// createContent(markup[, type = 'html'[, normalize = false]])
const htmlContent = createContent('<td>any content</td>');
const svgContent = createContent('<rect x=1 y=2 />', 'svg');