UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

25 lines (22 loc) 685 B
import { parseStyleObject } from './parseStyleObject.mjs'; import { parseStyleString } from './parseStyleString.mjs'; /** * Parses "style" attribute, retuning an object with values * @param {SVGElement} element Element to parse * @return {Object} Objects with values parsed from style attribute of an element */ function parseStyleAttribute(element) { const oStyle = {}, style = element.getAttribute('style'); if (!style) { return oStyle; } if (typeof style === 'string') { parseStyleString(style, oStyle); } else { parseStyleObject(style, oStyle); } return oStyle; } export { parseStyleAttribute }; //# sourceMappingURL=parseStyleAttribute.mjs.map