File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
packages/compiler-ssr/src/transforms Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import {
39
39
isBooleanAttr ,
40
40
isBuiltInDirective ,
41
41
isSSRSafeAttrName ,
42
+ isString ,
42
43
propsToAttrMap ,
43
44
} from '@vue/shared'
44
45
import { SSRErrorCodes , createSSRCompilerError } from '../errors'
@@ -423,9 +424,16 @@ function removeStaticBinding(
423
424
tag : TemplateLiteral [ 'elements' ] ,
424
425
binding : string ,
425
426
) {
426
- const regExp = new RegExp ( `^ ${ binding } =".+"$` )
427
-
428
- const i = tag . findIndex ( e => typeof e === 'string' && regExp . test ( e ) )
427
+ const bindingStart = ` ${ binding } ="`
428
+ // tag must end with at least one character and "
429
+ const minLen = bindingStart . length + 2
430
+ const i = tag . findIndex (
431
+ e =>
432
+ isString ( e ) &&
433
+ e . length >= minLen &&
434
+ e . startsWith ( bindingStart ) &&
435
+ e [ e . length - 1 ] === '"' ,
436
+ )
429
437
430
438
if ( i > - 1 ) {
431
439
tag . splice ( i , 1 )
You can’t perform that action at this time.
0 commit comments