Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/twenty-shoes-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

Fix disabling prefix for animation
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,19 @@ function is_global_block_selector(simple_selector) {
);
}

/**
*
* @param {Array<AST.CSS.Node>} path
*/
function is_in_global_block(path) {
return path.some((node) => node.type === 'Rule' && node.metadata.is_global_block);
}

/** @type {CssVisitors} */
const css_visitors = {
Atrule(node, context) {
if (is_keyframes_node(node)) {
if (!node.prelude.startsWith('-global-')) {
if (!node.prelude.startsWith('-global-') && !is_in_global_block(context.path)) {
context.state.keyframes.push(node.prelude);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const visitors = {
const character = state.code.original[index];

if (regex_css_name_boundary.test(character)) {
// TODO FIX
if (state.keyframes.includes(name)) {
state.code.prependRight(index - name.length, `${state.hash}-`);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/svelte/tests/css/samples/global-block/expected.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
animation: svelte-xyz-test 1s;
}

.y{
animation: test-in 1s;
}

@keyframes test-in{
to{
opacity: 1;
Expand Down
4 changes: 4 additions & 0 deletions packages/svelte/tests/css/samples/global-block/input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
animation: test 1s;
}

.y{
animation: test-in 1s;
}

@keyframes test-in{
to{
opacity: 1;
Expand Down
Loading