fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
17 lines (15 loc) • 497 B
text/typescript
// TODO this file needs to go away, cross browser style support is not fabricjs domain.
/**
* wrapper for setting element's style
* @param {HTMLElement} element an HTMLElement
* @param {Object} styles to apply to element
*/
export function setStyle(element: HTMLElement, styles: Record<string, string>) {
const elementStyle = element.style;
if (!elementStyle) {
return;
}
Object.entries(styles).forEach(([property, value]) =>
elementStyle.setProperty(property, value),
);
}