vanilla-hamburger
Version:
A tiny framework agnostic hamburger button element for modern web apps
18 lines • 639 B
JavaScript
export const bar = '<div part="bar"></div>';
export const createTemplate = (tpl) => {
const template = document.createElement('template');
template.innerHTML = tpl;
return template;
};
export const createRoot = (node, tpl) => {
const root = node.shadowRoot || node.attachShadow({ mode: 'open' });
root.appendChild(tpl.content.cloneNode(true));
return root;
};
export const getStyles = (root) => Array.from(root.querySelectorAll('div')).map((bar) => bar.style);
export const setStyles = (style, props) => {
for (const p in props) {
style.setProperty(p, props[p]);
}
};
//# sourceMappingURL=dom.js.map