Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 6x 488x 488x 47x 81x 81x 59x 59x 59x 59x 47x | import { AttributeTransformer, Properties } from '.';
export class StyleTransformer implements AttributeTransformer {
transform(element: Properties) {
const style = element.getAttribute('style');
if (style != undefined) {
style
.split(';')
.map(value => value.trim())
.filter(value => value.length > 0)
.forEach((item: string) => {
if (item && item.includes(':')) {
const [key, value] = item.split(':');
if (key && key.length > 0 && value) {
element.addStyle(key.trim(), value.trim());
}
}
});
element.deleteAttribute('style');
}
}
}
|