@@ -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
@@ -646,7 +646,7 @@ function makeTerminalNodeLinkFn (el, dirName, value, options, def) {
646
646
function compileDirectives ( attrs , options ) {
647
647
var i = attrs . length
648
648
var dirs = [ ]
649
- var attr , name , value , rawName , rawValue , dirName , arg , modifiers , dirDef , tokens
649
+ var attr , name , value , rawName , rawValue , dirName , arg , modifiers , dirDef , tokens , matched
650
650
while ( i -- ) {
651
651
attr = attrs [ i ]
652
652
name = rawName = attr . name
@@ -700,14 +700,9 @@ function compileDirectives (attrs, options) {
700
700
} else
701
701
702
702
// normal directives
703
- if ( name . indexOf ( 'v-' ) === 0 ) {
704
- // check arg
705
- arg = ( arg = name . match ( argRE ) ) && arg [ 1 ]
706
- if ( arg ) {
707
- name = name . replace ( argRE , '' )
708
- }
709
- // extract directive name
710
- dirName = name . slice ( 2 )
703
+ if ( ( matched = name . match ( dirAttrRE ) ) ) {
704
+ dirName = matched [ 1 ]
705
+ arg = matched [ 2 ]
711
706
712
707
// skip v-else (when used with v-show)
713
708
if ( dirName === 'else' ) {
0 commit comments