diff --git a/src/transformers/removeInlinedSelectors.js b/src/transformers/removeInlinedSelectors.js index b76f256f..a0ecfe6d 100644 --- a/src/transformers/removeInlinedSelectors.js +++ b/src/transformers/removeInlinedSelectors.js @@ -71,7 +71,12 @@ const plugin = posthtmlOptions => tree => { } catch {} }) - node.content = root.toString() + node.content = root.toString().trim() + + // Remove - + } +
@@ -529,6 +525,30 @@ test('remove inlined selectors', async t => { ` + const html2 = ` + + + + + + ` + + const expectedNoEmptyStyleTags = ` + + + + + + ` + + const basic = await Maizzle.removeInlinedClasses(html) + const noEmptyStyle = await Maizzle.removeInlinedClasses(html2) + const withPostHTMLOptions = await Maizzle.removeInlinedClasses(html, { build: { posthtml: { @@ -539,10 +559,9 @@ test('remove inlined selectors', async t => { } }) - const basic = await Maizzle.removeInlinedClasses(html) - - t.is(withPostHTMLOptions, expectedWithOptions) - t.is(basic, expectedWithOptions) + t.is(basic, expectedHTML) + t.is(withPostHTMLOptions, expectedHTML) + t.is(noEmptyStyle, expectedNoEmptyStyleTags) }) test('remove inlined selectors (disabled)', async t => {