Merge d9a88fea28
into 5f8314cb7f
This commit is contained in:
commit
0872155f1b
|
@ -39,6 +39,7 @@ import {
|
||||||
isBooleanAttr,
|
isBooleanAttr,
|
||||||
isBuiltInDirective,
|
isBuiltInDirective,
|
||||||
isSSRSafeAttrName,
|
isSSRSafeAttrName,
|
||||||
|
isString,
|
||||||
propsToAttrMap,
|
propsToAttrMap,
|
||||||
} from '@vue/shared'
|
} from '@vue/shared'
|
||||||
import { SSRErrorCodes, createSSRCompilerError } from '../errors'
|
import { SSRErrorCodes, createSSRCompilerError } from '../errors'
|
||||||
|
@ -423,9 +424,16 @@ function removeStaticBinding(
|
||||||
tag: TemplateLiteral['elements'],
|
tag: TemplateLiteral['elements'],
|
||||||
binding: string,
|
binding: string,
|
||||||
) {
|
) {
|
||||||
const regExp = new RegExp(`^ ${binding}=".+"$`)
|
const bindingStart = ` ${binding}="`
|
||||||
|
// tag must end with at least one character and "
|
||||||
const i = tag.findIndex(e => typeof e === 'string' && regExp.test(e))
|
const minLen = bindingStart.length + 2
|
||||||
|
const i = tag.findIndex(
|
||||||
|
e =>
|
||||||
|
isString(e) &&
|
||||||
|
e.length >= minLen &&
|
||||||
|
e.startsWith(bindingStart) &&
|
||||||
|
e[e.length - 1] === '"',
|
||||||
|
)
|
||||||
|
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
tag.splice(i, 1)
|
tag.splice(i, 1)
|
||||||
|
|
Loading…
Reference in New Issue