Skip to content
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

fix(compiler-sfc): support global selector nesting #12416

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yangxiuxiu1115
Copy link
Contributor

@yangxiuxiu1115 yangxiuxiu1115 commented Nov 16, 2024

fix #12404
fix #12405

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB 37.9 kB 34.2 kB
vue.global.prod.js 158 kB 57.8 kB 51.4 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 47.2 kB 18.3 kB 16.8 kB
createApp 55.2 kB 21.3 kB 19.5 kB
createSSRApp 59.3 kB 23.1 kB 21 kB
defineCustomElement 60.1 kB 22.9 kB 20.8 kB
overall 69.1 kB 26.5 kB 24.1 kB

Copy link

pkg-pr-new bot commented Nov 16, 2024

Open in Stackblitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@12416

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@12416

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@12416

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@12416

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@12416

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@12416

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@12416

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@12416

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@12416

vue

pnpm add https://pkg.pr.new/vue@12416

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@12416

commit: 436415a

expect(compileScoped(`.baz .qux ::v-global(.foo .bar) { color: red; }`))
.toMatchInlineSnapshot(`
".foo .bar { color: red;
".baz .qux[data-v-test] .foo .bar { color: red;
Copy link
Member

@edison1105 edison1105 Nov 18, 2024

Choose a reason for hiding this comment

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

The original behavior was that global would ignore the preceding rules, but it will no longer do so after this PR. this will introduce some edge cases. see:

@edison1105 edison1105 added scope: sfc 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready for review This PR requires more reviews ready to merge The PR is ready to be merged. and removed ready for review This PR requires more reviews labels Nov 18, 2024
Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

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

I've been experimenting with this and I'm wondering about some apparent inconsistencies in how selectors are handled. For example:

The background-color is applied to some of the headings, but not others. It's not really clear to me what would be considered correct here, but I can't really justify the differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged. scope: sfc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

:global doesn't work with CSS nesting :global(A) B incorrectly compiles to just A
3 participants