Skip to content

fix(compiler-vapor): keep the leading newline of pre and textarea - #15543

Merged
edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-pre-leading-newline
Sep 16, 2026
Merged

edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-pre-leading-newline

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor
<pre>

<b>{{ v }}</b></pre>

throws TypeError: Cannot read properties of null (reading 'firstChild'). Without a binding the newline is lost silently instead — <pre>\n\nline</pre> renders as <pre>line</pre>, where vdom renders <pre>\nline</pre>. Same for <textarea>, and for a first child that is an element, a comment, v-if, v-for or a nested <pre>.

The HTML parser drops the first newline after a <pre>/<textarea> start tag, and our own parser already applied that rule while building the AST. The generated template string is parsed as HTML again at runtime, so a newline that survived into it is dropped a second time — taking with it the text node the generated code walks past.

transformElement now doubles that newline, reusing isIgnoreNewlineTag from compiler-dom and guarding on the HTML namespace so <pre> inside <svg> is left alone. Client render only: SSR output and hydration are unchanged, and the SSR↔client mismatch they still have exists in vdom too (#11873).

@coderabbitai

coderabbitai Bot commented Sep 16, 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

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 4f4d57ee-7862-469b-9a4a-22ca083907ef

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

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

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@15543
npm i https://pkg.pr.new/@vue/compiler-core@15543
yarn add https://pkg.pr.new/@vue/compiler-core@15543.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@15543
npm i https://pkg.pr.new/@vue/compiler-dom@15543
yarn add https://pkg.pr.new/@vue/compiler-dom@15543.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@15543
npm i https://pkg.pr.new/@vue/compiler-sfc@15543
yarn add https://pkg.pr.new/@vue/compiler-sfc@15543.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@15543
npm i https://pkg.pr.new/@vue/compiler-ssr@15543
yarn add https://pkg.pr.new/@vue/compiler-ssr@15543.tgz

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@15543
npm i https://pkg.pr.new/@vue/compiler-vapor@15543
yarn add https://pkg.pr.new/@vue/compiler-vapor@15543.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@15543
npm i https://pkg.pr.new/@vue/reactivity@15543
yarn add https://pkg.pr.new/@vue/reactivity@15543.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@15543
npm i https://pkg.pr.new/@vue/runtime-core@15543
yarn add https://pkg.pr.new/@vue/runtime-core@15543.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@15543
npm i https://pkg.pr.new/@vue/runtime-dom@15543
yarn add https://pkg.pr.new/@vue/runtime-dom@15543.tgz

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@15543
npm i https://pkg.pr.new/@vue/runtime-vapor@15543
yarn add https://pkg.pr.new/@vue/runtime-vapor@15543.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@15543
npm i https://pkg.pr.new/@vue/server-renderer@15543
yarn add https://pkg.pr.new/@vue/server-renderer@15543.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@15543
npm i https://pkg.pr.new/@vue/shared@15543
yarn add https://pkg.pr.new/@vue/shared@15543.tgz

vue

pnpm add https://pkg.pr.new/vue@15543
npm i https://pkg.pr.new/vue@15543
yarn add https://pkg.pr.new/vue@15543.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@15543
npm i https://pkg.pr.new/@vue/compat@15543
yarn add https://pkg.pr.new/@vue/compat@15543.tgz

commit: 0fb1be7

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.2 kB 30.6 kB 26.9 kB
runtime-dom.global.prod.js 116 kB 43.7 kB 39.1 kB
vue.global.prod.js 176 kB 63.9 kB 56.8 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.2 kB 20.6 kB 18.8 kB
createApp 61.9 kB 23.8 kB 21.7 kB
createApp + vaporInteropPlugin 120 kB 43.3 kB 39 kB
createVaporApp 30.7 kB 11.8 kB 10.8 kB
createSSRApp 67.1 kB 25.9 kB 23.5 kB
createVaporSSRApp 37.1 kB 14.1 kB 12.9 kB
defineCustomElement 68.5 kB 25.8 kB 23.5 kB
defineVaporCustomElement 46.1 kB 16.8 kB 15.4 kB
overall 77.3 kB 29.4 kB 26.6 kB

@edison1105 edison1105 added the scope: vapor related to vapor mode label Sep 16, 2026
@edison1105
edison1105 merged commit addc884 into vuejs:minor Sep 16, 2026
15 checks passed
@ValentinYoushkevich
ValentinYoushkevich deleted the fix/vapor-pre-leading-newline branch September 17, 2026 04:43
zhiyuanzmj added a commit to vuejs/vue-jsx-vapor that referenced this pull request Sep 19, 2026
zhiyuanzmj added a commit to vuejs/vue-jsx-vapor that referenced this pull request Sep 19, 2026
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