summaryrefslogtreecommitdiff
path: root/node_modules/svgo/plugins/removeUnknownsAndDefaults.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/svgo/plugins/removeUnknownsAndDefaults.js')
-rw-r--r--node_modules/svgo/plugins/removeUnknownsAndDefaults.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/node_modules/svgo/plugins/removeUnknownsAndDefaults.js b/node_modules/svgo/plugins/removeUnknownsAndDefaults.js
index c67845cd..7462e8dc 100644
--- a/node_modules/svgo/plugins/removeUnknownsAndDefaults.js
+++ b/node_modules/svgo/plugins/removeUnknownsAndDefaults.js
@@ -99,6 +99,7 @@ exports.fn = (root, params) => {
unknownContent = true,
unknownAttrs = true,
defaultAttrs = true,
+ defaultMarkupDeclarations = true,
uselessOverrides = true,
keepDataAttrs = true,
keepAriaAttrs = true,
@@ -107,6 +108,13 @@ exports.fn = (root, params) => {
const stylesheet = collectStylesheet(root);
return {
+ instruction: {
+ enter: (node) => {
+ if (defaultMarkupDeclarations) {
+ node.value = node.value.replace(/\s*standalone\s*=\s*(["'])no\1/, '');
+ }
+ },
+ },
element: {
enter: (node, parentNode) => {
// skip namespaced elements
@@ -182,16 +190,12 @@ exports.fn = (root, params) => {
attributesDefaults.get(name) === value
) {
// keep defaults if parent has own or inherited style
- if (
- computedParentStyle == null ||
- computedParentStyle[name] == null
- ) {
+ if (computedParentStyle?.[name] == null) {
delete node.attributes[name];
}
}
if (uselessOverrides && node.attributes.id == null) {
- const style =
- computedParentStyle == null ? null : computedParentStyle[name];
+ const style = computedParentStyle?.[name];
if (
presentationNonInheritableGroupAttrs.includes(name) === false &&
style != null &&