Repository: Automattic/juice (js)

Issue:
'removeStyleTags' does not remove empty style tag
Check example of this issue here: https://runkit.com/nekocode/juice-empty-tag


Pull request description:
fix #359
This PR fixes issue #359 

Patch:
diff --git a/lib/inline.js b/lib/inline.js
index 2899c04..c6e80f7 100644
--- a/lib/inline.js
+++ b/lib/inline.js
@@ -341,6 +341,9 @@ function getStylesData($, options) {
     styleElement = this;
     styleDataList = styleElement.childNodes;
     if (styleDataList.length !== 1) {
+      if (options.removeStyleTags) {
+        $(styleElement).remove();
+      }
       return;
     }
     styleData = styleDataList[0].data;


Test patch:
diff --git a/test/cases/juice-content/empty-style-tag.css b/test/cases/juice-content/empty-style-tag.css
new file mode 100644
index 0000000..e69de29
diff --git a/test/cases/juice-content/empty-style-tag.html b/test/cases/juice-content/empty-style-tag.html
new file mode 100644
index 0000000..0656ae1
--- /dev/null
+++ b/test/cases/juice-content/empty-style-tag.html
@@ -0,0 +1,6 @@
+<html>
+  <head>
+    <style></style>
+  </head>
+  <body></body>
+</html>
diff --git a/test/cases/juice-content/empty-style-tag.json b/test/cases/juice-content/empty-style-tag.json
new file mode 100644
index 0000000..2c37ae8
--- /dev/null
+++ b/test/cases/juice-content/empty-style-tag.json
@@ -0,0 +1,3 @@
+{
+  "removeStyleTags": true
+}
\ No newline at end of file
diff --git a/test/cases/juice-content/empty-style-tag.out b/test/cases/juice-content/empty-style-tag.out
new file mode 100644
index 0000000..14f27db
--- /dev/null
+++ b/test/cases/juice-content/empty-style-tag.out
@@ -0,0 +1,6 @@
+<html>
+  <head>
+    
+  </head>
+  <body></body>
+</html>