Files
game-cards-poker-design/frontend/node_modules/fabric/src/parser/parseStyleAttribute.ts
Poker Design Developer 5dbcebf7a2 Fix frontend blank page issues
- Fix router import path in main.js
- Handle Django REST Framework pagination format in API calls
- Add getTemplates function to project API
- Restart frontend development server
2026-05-31 18:40:56 +08:00

27 lines
678 B
TypeScript

import { parseStyleObject } from './parseStyleObject';
import { parseStyleString } from './parseStyleString';
/**
* 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
*/
export function parseStyleAttribute(
element: HTMLElement | SVGElement,
): Record<string, any> {
const oStyle: Record<string, any> = {},
style = element.getAttribute('style');
if (!style) {
return oStyle;
}
if (typeof style === 'string') {
parseStyleString(style, oStyle);
} else {
parseStyleObject(style, oStyle);
}
return oStyle;
}