mirror of
https://github.com/svg/svgo.git
synced 2025-07-31 07:44:22 +03:00
Disable removeUselessStrokeAndFill if there is a <style> or <script>
This commit is contained in:
@ -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');
|
||||
|
Reference in New Issue
Block a user