convertStyle static method
void
convertStyle(
- XmlElement element
Convert style to attributes
Implementation
static void convertStyle(XmlElement element) {
final style = element.getAttribute('style')?.trim();
if (style != null && style.isNotEmpty) {
for (final style in style.split(';')) {
if (style.trim().isEmpty) {
continue;
}
final kv = RegExp(r'([\w-]+)\s*:\s*(.*)').allMatches(style).first;
final key = kv.group(1)!;
final value = kv.group(2)!;
element.setAttribute(key, value);
}
}
}