From bf1f49b3470533e78de7c0eb4944edc2ac4f5b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Sun, 3 May 2015 01:27:30 +0200 Subject: [PATCH] Fix problem where style attribute wasn't properly assembled in element stringification --- lib/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/index.js b/lib/index.js index 8fbf236b..2f04630e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -75,6 +75,10 @@ function stringifyStartTag(element) { str += ' ' + key; } else if (key === 'class') { str += ' class="' + attrs[key].join(' ') + '"'; + } else if (key === 'style') { + str += ' class="' + Object.keys(attrs[key]).map(function (cssProp) { + return [cssProp, attrs[key][cssProp]].join(': '); + }).join('; ') + '"'; } else { str += ' ' + key + '="' + attrs[key].replace(/&/g, '&').replace(/"/g, '"') + '"'; }