fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
1 lines • 1.07 kB
Source Map (JSON)
{"version":3,"file":"dom_style.min.mjs","sources":["../../../src/util/dom_style.ts"],"sourcesContent":["// TODO this file needs to go away, cross browser style support is not fabricjs domain.\n\n/**\n * wrapper for setting element's style\n * @param {HTMLElement} element\n * @param {Object | string} styles\n */\nexport function setStyle(\n element: HTMLElement,\n styles: string | Record<string, string>,\n) {\n const elementStyle = element.style;\n if (!elementStyle || !styles) {\n return;\n } else if (typeof styles === 'string') {\n elementStyle.cssText += ';' + styles;\n } else {\n Object.entries(styles).forEach(([property, value]) =>\n elementStyle.setProperty(property, value),\n );\n }\n}\n"],"names":["setStyle","element","styles","elementStyle","style","cssText","Object","entries","forEach","_ref","property","value","setProperty"],"mappings":"AAOO,SAASA,EACdC,EACAC,GAEA,MAAMC,EAAeF,EAAQG,MACxBD,GAAiBD,IAEO,iBAAXA,EAChBC,EAAaE,SAAW,IAAMH,EAE9BI,OAAOC,QAAQL,GAAQM,SAAQC,IAAA,IAAEC,EAAUC,GAAMF,EAAA,OAC/CN,EAAaS,YAAYF,EAAUC,EAAM,IAG/C"}