@@ -22,7 +22,7 @@ import {
22
22
// special binding prefixes
23
23
const bindRE = / ^ v - b i n d : | ^ : /
24
24
const onRE = / ^ v - o n : | ^ @ /
25
- const argRE = / : ( .* ) $ /
25
+ const dirAttrRE = / ^ v - ( [ ^ : ] + ) (?: $ | : ( .* ) $ ) /
26
26
const modifierRE = / \. [ ^ \. ] + / g
27
27
const transitionRE = / ^ ( v - b i n d : | : ) ? t r a n s i t i o n $ /
28
28
@@ -643,7 +643,7 @@ function makeTerminalNodeLinkFn (el, dirName, value, options, def) {
643
643
function compileDirectives ( attrs , options ) {
644
644
var i = attrs . length
645
645
var dirs = [ ]
646
- var attr , name , value , rawName , rawValue , dirName , arg , modifiers , dirDef , tokens
646
+ var attr , name , value , rawName , rawValue , dirName , arg , modifiers , dirDef , tokens , matched
647
647
while ( i -- ) {
648
648
attr = attrs [ i ]
649
649
name = rawName = attr . name
@@ -701,14 +701,9 @@ function compileDirectives (attrs, options) {
701
701
} else
702
702
703
703
// normal directives
704
- if ( name . indexOf ( 'v-' ) === 0 ) {
705
- // check arg
706
- arg = ( arg = name . match ( argRE ) ) && arg [ 1 ]
707
- if ( arg ) {
708
- name = name . replace ( argRE , '' )
709
- }
710
- // extract directive name
711
- dirName = name . slice ( 2 )
704
+ if ( ( matched = name . match ( dirAttrRE ) ) ) {
705
+ dirName = matched [ 1 ]
706
+ arg = matched [ 2 ]
712
707
713
708
// skip v-else (when used with v-show)
714
709
if ( dirName === 'else' ) {
0 commit comments