UNPKG

fabric

Version:

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

1 lines 1.11 kB
{"version":3,"file":"parseStyleAttribute.min.mjs","sources":["../../../src/parser/parseStyleAttribute.ts"],"sourcesContent":["import { parseStyleObject } from './parseStyleObject';\nimport { parseStyleString } from './parseStyleString';\n\n/**\n * Parses \"style\" attribute, retuning an object with values\n * @param {SVGElement} element Element to parse\n * @return {Object} Objects with values parsed from style attribute of an element\n */\nexport function parseStyleAttribute(\n element: HTMLElement | SVGElement,\n): Record<string, any> {\n const oStyle: Record<string, any> = {},\n style = element.getAttribute('style');\n\n if (!style) {\n return oStyle;\n }\n\n if (typeof style === 'string') {\n parseStyleString(style, oStyle);\n } else {\n parseStyleObject(style, oStyle);\n }\n\n return oStyle;\n}\n"],"names":["parseStyleAttribute","element","oStyle","style","getAttribute","parseStyleString","parseStyleObject"],"mappings":"4HAQO,SAASA,EACdC,GAEA,MAAMC,EAA8B,CAAA,EAClCC,EAAQF,EAAQG,aAAa,SAE/B,OAAKD,GAIgB,iBAAVA,EACTE,EAAiBF,EAAOD,GAExBI,EAAiBH,EAAOD,GAGnBA,GATEA,CAUX"}