@@ -77,25 +77,26 @@ var DirProto = Directive.prototype
77
77
*/
78
78
function parseKey ( dir , rawKey ) {
79
79
80
- var argMatch = rawKey . match ( ARG_RE )
81
-
82
- var key = argMatch
83
- ? argMatch [ 2 ] . trim ( )
84
- : rawKey . trim ( )
85
-
86
- dir . arg = argMatch
87
- ? argMatch [ 1 ] . trim ( )
88
- : null
80
+ var key = rawKey
81
+ if ( rawKey . indexOf ( ':' ) > - 1 ) {
82
+ var argMatch = rawKey . match ( ARG_RE )
83
+ key = argMatch
84
+ ? argMatch [ 2 ] . trim ( )
85
+ : key
86
+ dir . arg = argMatch
87
+ ? argMatch [ 1 ] . trim ( )
88
+ : null
89
+ }
89
90
90
- var nesting = key . match ( NESTING_RE )
91
- dir . nesting = nesting
92
- ? nesting [ 0 ] . length
91
+ // nesting
92
+ var firstChar = key . charAt ( 0 )
93
+ dir . root = firstChar === '*'
94
+ dir . nesting = firstChar === '^'
95
+ ? key . match ( NESTING_RE ) [ 0 ] . length
93
96
: false
94
97
95
- dir . root = key . charAt ( 0 ) === '*'
96
-
97
98
if ( dir . nesting ) {
98
- key = key . replace ( NESTING_RE , '' )
99
+ key = key . slice ( dir . nesting )
99
100
} else if ( dir . root ) {
100
101
key = key . slice ( 1 )
101
102
}
@@ -204,7 +205,9 @@ DirProto.unbind = function (update) {
204
205
* multiple clauses
205
206
*/
206
207
Directive . split = function ( exp ) {
207
- return exp . match ( SPLIT_RE ) || [ '' ]
208
+ return exp . indexOf ( ',' ) > - 1
209
+ ? exp . match ( SPLIT_RE ) || [ '' ]
210
+ : [ exp ]
208
211
}
209
212
210
213
/**
@@ -220,8 +223,16 @@ Directive.parse = function (dirname, expression, compiler, node) {
220
223
var dir = compiler . getOption ( 'directives' , dirname ) || directives [ dirname ]
221
224
if ( ! dir ) return utils . warn ( 'unknown directive: ' + dirname )
222
225
223
- var keyMatch = expression . match ( KEY_RE ) ,
224
- rawKey = keyMatch && keyMatch [ 0 ] . trim ( )
226
+ var rawKey
227
+ if ( expression . indexOf ( '|' ) > - 1 ) {
228
+ var keyMatch = expression . match ( KEY_RE )
229
+ if ( keyMatch ) {
230
+ rawKey = keyMatch [ 0 ] . trim ( )
231
+ }
232
+ } else {
233
+ rawKey = expression . trim ( )
234
+ }
235
+
225
236
// have a valid raw key, or be an empty directive
226
237
return ( rawKey || expression === '' )
227
238
? new Directive ( dir , expression , rawKey , compiler , node )
0 commit comments