diff --git a/plugins/removeUselessStrokeAndFill.js b/plugins/removeUselessStrokeAndFill.js
index 5e2819c8..9ae569fb 100644
--- a/plugins/removeUselessStrokeAndFill.js
+++ b/plugins/removeUselessStrokeAndFill.js
@@ -11,7 +11,9 @@ exports.params = {
var shape = require('./_collections').elemsGroups.shape,
regStrokeProps = /^stroke/,
- regFillProps = /^fill-/;
+ regFillProps = /^fill-/,
+ styleOrScript = ['style', 'script'],
+ hasStyleOrScript = false;
/**
* Remove useless stroke and fill attrs.
@@ -24,7 +26,11 @@ var shape = require('./_collections').elemsGroups.shape,
*/
exports.fn = function(item, params) {
- if (item.isElem(shape) && !item.computedAttr('id')) {
+ if (item.isElem(styleOrScript)) {
+ hasStyleOrScript = true;
+ }
+
+ if (!hasStyleOrScript && item.isElem(shape) && !item.computedAttr('id')) {
var stroke = params.stroke && item.computedAttr('stroke'),
fill = params.fill && !item.computedAttr('fill', 'none');
diff --git a/test/plugins/removeUselessStrokeAndFill.03.svg b/test/plugins/removeUselessStrokeAndFill.03.svg
new file mode 100644
index 00000000..a026e80d
--- /dev/null
+++ b/test/plugins/removeUselessStrokeAndFill.03.svg
@@ -0,0 +1,21 @@
+
+
+@@@
+
+