From ceb9753b5ade51bfe787fa5ba3b015690bd9c3bb Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 3 Jun 2024 15:05:27 +0300 Subject: [PATCH 1/3] reproduce bug --- lib/style.test.js | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/lib/style.test.js b/lib/style.test.js index 544926beb..f904ede23 100644 --- a/lib/style.test.js +++ b/lib/style.test.js @@ -356,3 +356,64 @@ it('ignores @-webkit-keyframes atrule', () => { }, }); }); +it('ignores @-moz-keyframes atrule', () => { + const root = parseSvg(` + + + + + `); + const stylesheet = collectStylesheet(root); + expect( + computeStyle(stylesheet, getElementById(root, 'element')), + ).toStrictEqual({ + animation: { + type: 'static', + inherited: false, + value: 'loading 4s linear infinite', + }, + }); +}); + +it('ignores @-o-keyframes atrule', () => { + const root = parseSvg(` + + + + + `); + const stylesheet = collectStylesheet(root); + expect( + computeStyle(stylesheet, getElementById(root, 'element')), + ).toStrictEqual({ + animation: { + type: 'static', + inherited: false, + value: 'loading 4s linear infinite', + }, + }); +}); From 704e5a1c23fd205b53869f08a02279eee9a134a7 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 3 Jun 2024 15:07:03 +0300 Subject: [PATCH 2/3] fix keyframes --- lib/style.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/style.js b/lib/style.js index 5c1570d9e..ff8aa9864 100644 --- a/lib/style.js +++ b/lib/style.js @@ -85,7 +85,9 @@ const parseStylesheet = (css, dynamic) => { if (cssNode.type === 'Atrule') { if ( cssNode.name === 'keyframes' || - cssNode.name === '-webkit-keyframes' + cssNode.name === '-webkit-keyframes' || + cssNode.name === '-o-keyframes' || + cssNode.name === '-moz-keyframes' ) { return csstreeWalkSkip; } From 4cd65f1de079bc00ee56a2a76f6a69477bce8540 Mon Sep 17 00:00:00 2001 From: Vlad Date: Thu, 6 Jun 2024 13:54:07 +0300 Subject: [PATCH 3/3] refactor to use includes --- lib/style.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/style.js b/lib/style.js index ff8aa9864..8f047cd20 100644 --- a/lib/style.js +++ b/lib/style.js @@ -84,10 +84,12 @@ const parseStylesheet = (css, dynamic) => { } if (cssNode.type === 'Atrule') { if ( - cssNode.name === 'keyframes' || - cssNode.name === '-webkit-keyframes' || - cssNode.name === '-o-keyframes' || - cssNode.name === '-moz-keyframes' + [ + 'keyframes', + '-webkit-keyframes', + '-o-keyframes', + '-moz-keyframes', + ].includes(cssNode.name) ) { return csstreeWalkSkip; }