Skip to content

fix(compiler-sfc): properly rewrite universal selector scope #12908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/compiler-sfc/__tests__/compileStyle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ describe('SFC style preprocessors', () => {
}"
`)
expect(compileScoped(`.foo * { color: red; }`)).toMatchInlineSnapshot(`
".foo[data-v-test] * { color: red;
".foo *[data-v-test] { color: red;
}"
`)
})
Expand Down
7 changes: 5 additions & 2 deletions packages/compiler-sfc/src/style/pluginScoped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ function rewriteSelector(
return false
}
}
// .foo * -> .foo[xxxxxxx] *
if (node) return
// .foo * -> .foo *[xxxxxxx]
Copy link
Member Author

@edison1105 edison1105 Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (node) {
node = n
return
}
}

if (
Expand Down