@@ -13,29 +13,14 @@ import { makeMap, no } from 'shared/util'
1313import { isNonPhrasingTag } from 'web/compiler/util'
1414
1515// Regular Expressions for parsing tags and attributes
16- const singleAttrIdentifier = / ( [ ^ \s " ' < > / = ] + ) /
17- const singleAttrAssign = / ( = ) /
18- const singleAttrValues = [
19- // attr value double quotes
20- / " ( [ ^ " ] * ) " + / . source ,
21- // attr value, single quotes
22- / ' ( [ ^ ' ] * ) ' + / . source ,
23- // attr value, no quotes
24- / ( [ ^ \s " ' = < > ` ] + ) / . source
25- ]
26- const attribute = new RegExp (
27- '^\\s*' + singleAttrIdentifier . source +
28- '(?:\\s*' + singleAttrAssign . source +
29- '\\s*(?:' + singleAttrValues . join ( '|' ) + '))?'
30- )
31-
16+ const attribute = / ^ \s * ( [ ^ \s " ' < > \/ = ] + ) (?: \s * ( = ) \s * (?: " ( [ ^ " ] * ) " + | ' ( [ ^ ' ] * ) ' + | ( [ ^ \s " ' = < > ` ] + ) ) ) ? /
3217// could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
3318// but for Vue templates we can enforce a simple charset
3419const ncname = '[a-zA-Z_][\\w\\-\\.]*'
35- const qnameCapture = ' ((?:' + ncname + ' \\:)?' + ncname + ')'
36- const startTagOpen = new RegExp ( '^<' + qnameCapture )
20+ const qnameCapture = ` ((?:${ ncname } \\:)?${ ncname } )`
21+ const startTagOpen = new RegExp ( `^< ${ qnameCapture } ` )
3722const startTagClose = / ^ \s * ( \/ ? ) > /
38- const endTag = new RegExp ( ' ^<\\/' + qnameCapture + ' [^>]*>' )
23+ const endTag = new RegExp ( ` ^<\\/${ qnameCapture } [^>]*>` )
3924const doctype = / ^ < ! D O C T Y P E [ ^ > ] + > / i
4025const comment = / ^ < ! - - /
4126const conditionalComment = / ^ < ! \[ /
0 commit comments