Skip to content

Commit fac05f3

Browse files
committed
minor style tweaks
1 parent cd3bac9 commit fac05f3

File tree

3 files changed

+58
-49
lines changed

3 files changed

+58
-49
lines changed

packages/svelte/src/compiler/phases/2-analyze/css/Stylesheet.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { push_array } from '../utils/push_array.js';
88
import { create_attribute } from '../../nodes.js';
99

1010
const regex_css_browser_prefix = /^-((webkit)|(moz)|(o)|(ms))-/;
11-
const regex_name_sequence = /^[\s,;}]$/;
11+
const regex_name_boundary = /^[\s,;}]$/;
1212
/**
1313
* @param {string} name
1414
* @returns {string}
@@ -217,16 +217,23 @@ class Declaration {
217217
let name = '';
218218

219219
while (index < code.original.length) {
220-
const current = code.original[index];
220+
const character = code.original[index];
221221

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);
225224

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+
}
227232

228233
name = '';
229-
} else name += current;
234+
} else {
235+
name += character;
236+
}
230237

231238
index++;
232239
}
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11

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+
}
1010

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+
}
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
<h1>test</h1>
22

33
<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+
}
1212
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+
}
2627
</style>

0 commit comments

Comments
 (0)