Skip to content

fix(compiler-vapor): only treat html whitespace as empty slot content - #16161

Merged
edison1105 merged 1 commit into
vuejs:minorfrom
simonkundrik:fix/vapor-nbsp-default-slot
Nov 9, 2026
Merged

edison1105 merged 1 commit into
vuejs:minorfrom
simonkundrik:fix/vapor-nbsp-default-slot

Conversation

@simonkundrik

Copy link
Copy Markdown

A default slot that only holds a non-breaking space (or another Unicode space like U+3000) is treated as empty in vapor mode, so the child renders its fallback. In vdom the space is rendered.

<!-- Child.vue -->
<template><b><slot>fallback</slot></b></template>

<!-- App.vue -->
<template><Child>&nbsp;</Child></template>

vdom renders <b>&nbsp;</b> and vapor renders <b>fallback</b>. When the child has no fallback, vapor renders nothing instead of the space, so something like <Button>&nbsp;</Button> or <Cell> </Cell> comes out empty.

isNonWhitespaceContent in compiler-vapor/src/transforms/vSlot.ts used String.prototype.trim(), which also strips NBSP, U+3000, U+FEFF and the other Unicode spaces. Core's buildSlots uses isWhitespaceText, which only counts HTML whitespace. This switches it to isAllWhitespace so the two agree. Explicit <template #default>&nbsp;</template> already worked.

I added a parity test for &nbsp;, &emsp;, &#x3000; and &#xFEFF;. It fails on minor and passes with the change. The compiler-vapor and runtime-vapor unit suites pass, and so do tsc and lint and format check on the changed files.

Found by rendering random templates in both modes and diffing the DOM.

String.prototype.trim also strips NBSP, U+3000, U+FEFF and the other
Unicode spaces, so an implicit default slot that only held one of them
was dropped and the child rendered its fallback. Core only counts html
whitespace here, so use the same check.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 430d38db-781e-4331-98a9-b7703aeafe75

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@edison1105 edison1105 added the scope: vapor related to vapor mode label Nov 9, 2026
@pkg-pr-new

pkg-pr-new Bot commented Nov 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@16161
npm i https://pkg.pr.new/@vue/compiler-core@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@16161
npm i https://pkg.pr.new/@vue/compiler-dom@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@16161
npm i https://pkg.pr.new/@vue/compiler-sfc@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@16161
npm i https://pkg.pr.new/@vue/compiler-ssr@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@16161
npm i https://pkg.pr.new/@vue/compiler-vapor@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@16161
npm i https://pkg.pr.new/@vue/reactivity@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@16161
npm i https://pkg.pr.new/@vue/runtime-core@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@16161
npm i https://pkg.pr.new/@vue/runtime-dom@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@16161
npm i https://pkg.pr.new/@vue/runtime-vapor@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@16161
npm i https://pkg.pr.new/@vue/server-renderer@16161
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@16161
npm i https://pkg.pr.new/@vue/shared@16161
yarn add https://pkg.pr.new/@vue/[email protected]

vue

pnpm add https://pkg.pr.new/vue@16161
npm i https://pkg.pr.new/vue@16161
yarn add https://pkg.pr.new/[email protected]

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@16161
npm i https://pkg.pr.new/@vue/compat@16161
yarn add https://pkg.pr.new/@vue/[email protected]

commit: b69605d

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.4 kB 30.7 kB 27 kB
runtime-dom.global.prod.js 123 kB 46.1 kB 41.2 kB
vue.global.prod.js 183 kB 66.3 kB 59.1 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 54.7 kB 21.3 kB 19.5 kB
createApp 63.6 kB 24.6 kB 22.4 kB
createApp + vaporInteropPlugin 118 kB 43.3 kB 39 kB
createVaporApp 34.2 kB 13.3 kB 12.2 kB
createSSRApp 68.6 kB 26.6 kB 24.1 kB
createVaporSSRApp 42 kB 16.1 kB 14.8 kB
defineCustomElement 70.2 kB 26.6 kB 24.1 kB
defineVaporCustomElement 49.3 kB 18.1 kB 16.6 kB
overall 80.6 kB 30.6 kB 27.7 kB

@edison1105
edison1105 merged commit 65f7e3a into vuejs:minor Nov 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: vapor related to vapor mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants