-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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-core): preserve whitespaces in texts full of whitespaces #7829
base: main
Are you sure you want to change the base?
Conversation
packages/compiler-core/src/parse.ts
Outdated
const isAllWhitespacesText = | ||
nodes.length === 1 && /^ +$/.test(node.content) // #7789 | ||
if (!/[^\t\r\n\f ]/.test(node.content) && !isAllWhitespacesText) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping to review this, but parse.ts
was removed as part of the parser rewrite.
I think this section of the new parser may be the equivalent functionality:
core/packages/compiler-core/src/parser.ts
Lines 821 to 831 in cdb1d17
function condenseWhitespace( | |
nodes: TemplateChildNode[], | |
tag?: string, | |
): TemplateChildNode[] { | |
const shouldCondense = currentOptions.whitespace !== 'preserve' | |
let removedWhitespace = false | |
for (let i = 0; i < nodes.length; i++) { | |
const node = nodes[i] | |
if (node.type === NodeTypes.TEXT) { | |
if (!inPre) { | |
if (isAllWhitespace(node.content)) { |
I also confirmed that the original issue is still present in 3.4.27.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already updated, I really appreciate your time.
527afe4
to
f5beac4
Compare
Size ReportBundles
Usages
|
commit: @vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
|
Fixes #7789