UNPKG

fabric

Version:

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

1 lines 1.12 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 * @static\n * @memberOf fabric\n * @param {SVGElement} element Element to parse\n * @return {Object} Objects with values parsed from style attribute of an element\n */\nexport function parseStyleAttribute(element: HTMLElement): 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":"4HAUO,SAASA,EAAoBC,GAClC,MAAMC,EAA8B,CAAE,EACpCC,EAAQF,EAAQG,aAAa,SAE/B,OAAKD,GAIgB,iBAAVA,EACTE,EAAiBF,EAAOD,GAExBI,EAAiBH,EAAOD,GAGnBA,GATEA,CAUX"}