0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-27 20:23:08 +00:00
Files
homebrewery/vitreum/injectTag.js
2026-01-23 18:51:01 +01:00

9 lines
341 B
JavaScript

const injectTag = (tag, props, children) => {
const injectNode = document.createElement(tag);
Object.entries(props).forEach(([key, val]) => injectNode[key] = val);
if (children) injectNode.appendChild(document.createTextNode(children));
document.getElementsByTagName('head')[0].appendChild(injectNode);
};
export default injectTag;