UNPKG

@anywhichway/lazui

Version:

Single page apps and lazy loading sites with minimal JavaScript or client build processes.

16 lines (14 loc) 497 B
function style({el,attribute,lazui}) { const {JSON} = lazui, style = JSON.parse(attribute.value); Object.entries(style).forEach(([key,value]) => { key = key.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? '-' : '') + match.toLowerCase()); el.style[key] = value; }) el.removeAttribute(attribute.name) } function styleItem({el,attribute,args,lazui}) { const key = args[0]; return el.style[key] = attribute.value; } export {style}