File tree 3 files changed +58
-49
lines changed
src/compiler/phases/2-analyze/css
tests/css/samples/animations 3 files changed +58
-49
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { push_array } from '../utils/push_array.js';
8
8
import { create_attribute } from '../../nodes.js' ;
9
9
10
10
const regex_css_browser_prefix = / ^ - ( ( w e b k i t ) | ( m o z ) | ( o ) | ( m s ) ) - / ;
11
- const regex_name_sequence = / ^ [ \s , ; } ] $ / ;
11
+ const regex_name_boundary = / ^ [ \s , ; } ] $ / ;
12
12
/**
13
13
* @param {string } name
14
14
* @returns {string }
@@ -217,16 +217,23 @@ class Declaration {
217
217
let name = '' ;
218
218
219
219
while ( index < code . original . length ) {
220
- const current = code . original [ index ] ;
220
+ const character = code . original [ index ] ;
221
221
222
- if ( regex_name_sequence . test ( current ) ) {
223
- if ( name && keyframes . has ( name ) )
224
- code . update ( index - name . length , index , /**@type {string }*/ ( keyframes . get ( name ) ) ) ;
222
+ if ( regex_name_boundary . test ( character ) ) {
223
+ const keyframe = keyframes . get ( name ) ;
225
224
226
- if ( current === ';' || current === '}' ) break ;
225
+ if ( keyframe ) {
226
+ code . update ( index - name . length , index , keyframe ) ;
227
+ }
228
+
229
+ if ( character === ';' || character === '}' ) {
230
+ break ;
231
+ }
227
232
228
233
name = '' ;
229
- } else name += current ;
234
+ } else {
235
+ name += character ;
236
+ }
230
237
231
238
index ++ ;
232
239
}
Original file line number Diff line number Diff line change 1
1
2
- @keyframes svelte-xyz-a {
3
- 0% {
4
- transform : scale (1 );
5
- }
6
- 100% {
7
- transform : scale (2 );
8
- }
9
- }
2
+ @keyframes svelte-xyz-a {
3
+ 0% {
4
+ transform : scale (1 );
5
+ }
6
+ 100% {
7
+ transform : scale (2 );
8
+ }
9
+ }
10
10
11
- @keyframes svelte-xyz-animation {
12
- 0% {
13
- transform : scale (1 );
14
- }
15
- 100% {
16
- transform : scale (2 );
17
- }
18
- }
19
- h1 .svelte-xyz {
20
- animation : 1s linear infinite svelte-xyz-a;
21
- animation : svelte-xyz-a 1s linear infinite;
22
- animation : 1s linear infinite svelte-xyz-a, svelte-xyz-animation 1s linear infinite;
23
- }
11
+ @keyframes svelte-xyz-animation {
12
+ 0% {
13
+ transform : scale (1 );
14
+ }
15
+ 100% {
16
+ transform : scale (2 );
17
+ }
18
+ }
19
+
20
+ h1 .svelte-xyz {
21
+ animation : 1s linear infinite svelte-xyz-a;
22
+ animation : svelte-xyz-a 1s linear infinite;
23
+ animation : 1s linear infinite svelte-xyz-a, svelte-xyz-animation 1s linear infinite;
24
+ }
Original file line number Diff line number Diff line change 1
1
<h1 >test</h1 >
2
2
3
3
<style >
4
- @keyframes a {
5
- 0% {
6
- transform : scale (1 );
7
- }
8
- 100% {
9
- transform : scale (2 );
10
- }
11
- }
4
+ @keyframes a {
5
+ 0% {
6
+ transform : scale (1 );
7
+ }
8
+ 100% {
9
+ transform : scale (2 );
10
+ }
11
+ }
12
12
13
- @keyframes animation {
14
- 0% {
15
- transform : scale (1 );
16
- }
17
- 100% {
18
- transform : scale (2 );
19
- }
20
- }
21
- h1 {
22
- animation : 1s linear infinite a;
23
- animation : a 1s linear infinite ;
24
- animation : 1s linear infinite a,animation 1s linear infinite ;
25
- }
13
+ @keyframes animation {
14
+ 0% {
15
+ transform : scale (1 );
16
+ }
17
+ 100% {
18
+ transform : scale (2 );
19
+ }
20
+ }
21
+
22
+ h1 {
23
+ animation : 1s linear infinite a;
24
+ animation : a 1s linear infinite ;
25
+ animation : 1s linear infinite a,animation 1s linear infinite ;
26
+ }
26
27
</style >
You can’t perform that action at this time.
0 commit comments