From 474654c6581e5c8ccbe62cf45744a83e8a75ed92 Mon Sep 17 00:00:00 2001 From: John Kenny Date: Mon, 19 Aug 2024 08:29:28 -0700 Subject: [PATCH] Add href to allowed attributes for animation elements. --- plugins/_collections.js | 5 ++ .../removeUnknownsAndDefaults.17.svg.txt | 49 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 test/plugins/removeUnknownsAndDefaults.17.svg.txt diff --git a/plugins/_collections.js b/plugins/_collections.js index 194b39fb6..9f074f066 100644 --- a/plugins/_collections.js +++ b/plugins/_collections.js @@ -118,6 +118,7 @@ export const attrsGroups = { animationAddition: new Set(['additive', 'accumulate']), animationAttributeTarget: new Set(['attributeType', 'attributeName']), animationEvent: new Set(['onbegin', 'onend', 'onrepeat', 'onload']), + animationTargetElement: new Set(['href']), animationTiming: new Set([ 'begin', 'dur', @@ -493,6 +494,7 @@ export const elems = { 'animationAddition', 'animationAttributeTarget', 'animationEvent', + 'animationTargetElement', 'animationTiming', 'animationValue', 'conditionalProcessing', @@ -522,6 +524,7 @@ export const elems = { attrsGroups: new Set([ 'animationAddition', 'animationEvent', + 'animationTargetElement', 'animationTiming', 'animationValue', 'conditionalProcessing', @@ -546,6 +549,7 @@ export const elems = { 'animationAddition', 'animationAttributeTarget', 'animationEvent', + 'animationTargetElement', 'animationTiming', 'animationValue', 'conditionalProcessing', @@ -1742,6 +1746,7 @@ export const elems = { attrsGroups: new Set([ 'animation', 'animationAttributeTarget', + 'animationTargetElement', 'animationTiming', 'conditionalProcessing', 'core', diff --git a/test/plugins/removeUnknownsAndDefaults.17.svg.txt b/test/plugins/removeUnknownsAndDefaults.17.svg.txt new file mode 100644 index 000000000..8a81c4127 --- /dev/null +++ b/test/plugins/removeUnknownsAndDefaults.17.svg.txt @@ -0,0 +1,49 @@ +Preserve both xlink:href and href attributes in animation elements. + +See: https://github.com/svg/svgo/issues/2061 + +=== + + + + + + + + + + + + + + + + + + + + + + + +@@@ + + + + + + + + + + + + + + + + + + +