refactor(ssr): adjust ssr fragment anchor content

This commit is contained in:
Evan You
2020-03-13 11:55:04 -04:00
parent cad5bcce40
commit a05d41c940
12 changed files with 57 additions and 56 deletions

View File

@@ -19,7 +19,7 @@ export function ssrRenderSlot(
parentComponent: ComponentInternalInstance
) {
// template-compiled slots are always rendered as fragments
push(`<!--1-->`)
push(`<!--[-->`)
const slotFn = slots[slotName]
if (slotFn) {
if (slotFn.length > 1) {
@@ -33,5 +33,5 @@ export function ssrRenderSlot(
} else if (fallbackRenderFn) {
fallbackRenderFn()
}
push(`<!--0-->`)
push(`<!--]-->`)
}

View File

@@ -9,9 +9,9 @@ export async function ssrRenderSuspense({
try {
if (renderContent) {
const { push, getBuffer } = createBuffer()
push(`<!--1-->`)
push(`<!--[-->`)
renderContent(push)
push(`<!--0-->`)
push(`<!--]-->`)
return await getBuffer()
} else {
return []
@@ -19,9 +19,9 @@ export async function ssrRenderSuspense({
} catch {
if (renderFallback) {
const { push, getBuffer } = createBuffer()
push(`<!--1-->`)
push(`<!--[-->`)
renderFallback(push)
push(`<!--0-->`)
push(`<!--]-->`)
return getBuffer()
} else {
return []

View File

@@ -256,9 +256,9 @@ function renderVNode(
push(children ? `<!--${children}-->` : `<!---->`)
break
case Fragment:
push(`<!--1-->`) // open
push(`<!--[-->`) // open
renderVNodeChildren(push, children as VNodeArrayChildren, parentComponent)
push(`<!--0-->`) // close
push(`<!--]-->`) // close
break
default:
if (shapeFlag & ShapeFlags.ELEMENT) {