Skip to content

Commit bf1f49b

Browse files
committed
Fix problem where style attribute wasn't properly assembled in element stringification
1 parent fd37b16 commit bf1f49b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ function stringifyStartTag(element) {
7575
str += ' ' + key;
7676
} else if (key === 'class') {
7777
str += ' class="' + attrs[key].join(' ') + '"';
78+
} else if (key === 'style') {
79+
str += ' class="' + Object.keys(attrs[key]).map(function (cssProp) {
80+
return [cssProp, attrs[key][cssProp]].join(': ');
81+
}).join('; ') + '"';
7882
} else {
7983
str += ' ' + key + '="' + attrs[key].replace(/&/g, '&').replace(/"/g, '"') + '"';
8084
}

0 commit comments

Comments
 (0)