perf(ssr): improve isComment check (#6078)
This commit is contained in:
parent
19236d2c90
commit
25f7a16a6e
@ -87,11 +87,11 @@ export function ssrRenderSlotInner(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const commentTestRE = /^<!--.*-->$/s
|
||||||
const commentRE = /<!--[^]*?-->/gm
|
const commentRE = /<!--[^]*?-->/gm
|
||||||
function isComment(item: SSRBufferItem) {
|
function isComment(item: SSRBufferItem) {
|
||||||
return (
|
if (typeof item !== 'string' || !commentTestRE.test(item)) return false
|
||||||
typeof item === 'string' &&
|
// if item is '<!---->' or '<!--[-->' or '<!--]-->', return true directly
|
||||||
commentRE.test(item) &&
|
if (item.length <= 8) return true
|
||||||
!item.replace(commentRE, '').trim()
|
return !item.replace(commentRE, '').trim()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user