@@ -242,15 +242,15 @@ CompilerProto.compile = function (node, root) {
242242 if ( repeatExp = utils . attr ( node , 'repeat' ) ) {
243243
244244 // repeat block cannot have v-id at the same time.
245- directive = Directive . parse ( config . attrs . repeat , repeatExp , compiler , node )
245+ directive = Directive . parse ( ' repeat' , repeatExp , compiler , node )
246246 if ( directive ) {
247247 compiler . bindDirective ( directive )
248248 }
249249
250250 // v-component has 2nd highest priority
251251 } else if ( ! root && ( componentExp = utils . attr ( node , 'component' ) ) ) {
252252
253- directive = Directive . parse ( config . attrs . component , componentExp , compiler , node )
253+ directive = Directive . parse ( ' component' , componentExp , compiler , node )
254254 if ( directive ) {
255255 // component directive is a bit different from the others.
256256 // when it has no argument, it should be treated as a
@@ -293,28 +293,44 @@ CompilerProto.compile = function (node, root) {
293293 * Compile a normal node
294294 */
295295CompilerProto . compileNode = function ( node ) {
296- var i , j , attrs = node . attributes
296+ var i , j ,
297+ attrs = node . attributes ,
298+ prefix = config . prefix + '-'
297299 // parse if has attributes
298300 if ( attrs && attrs . length ) {
299- var attr , valid , exps , exp
301+ var attr , isDirective , exps , exp , directive
300302 // loop through all attributes
301303 i = attrs . length
302304 while ( i -- ) {
303305 attr = attrs [ i ]
304- valid = false
305- exps = Directive . split ( attr . value )
306- // loop through clauses (separated by ",")
307- // inside each attribute
308- j = exps . length
309- while ( j -- ) {
310- exp = exps [ j ]
311- var directive = Directive . parse ( attr . name , exp , this , node )
312- if ( directive ) {
313- valid = true
314- this . bindDirective ( directive )
306+ isDirective = false
307+
308+ if ( attr . name . indexOf ( prefix ) === 0 ) {
309+ // a directive - split, parse and bind it.
310+ isDirective = true
311+ exps = Directive . split ( attr . value )
312+ // loop through clauses (separated by ",")
313+ // inside each attribute
314+ j = exps . length
315+ while ( j -- ) {
316+ exp = exps [ j ]
317+ directive = Directive . parse ( attr . name . slice ( prefix . length ) , exp , this , node )
318+ if ( directive ) {
319+ this . bindDirective ( directive )
320+ }
321+ }
322+ } else {
323+ // non directive attribute, check interpolation tags
324+ exp = TextParser . parseAttr ( attr . value )
325+ if ( exp ) {
326+ directive = Directive . parse ( 'attr' , attr . name + ':' + exp , this , node )
327+ if ( directive ) {
328+ this . bindDirective ( directive )
329+ }
315330 }
316331 }
317- if ( valid ) node . removeAttribute ( attr . name )
332+
333+ if ( isDirective ) node . removeAttribute ( attr . name )
318334 }
319335 }
320336 // recursively compile childNodes
@@ -332,8 +348,7 @@ CompilerProto.compileNode = function (node) {
332348CompilerProto . compileTextNode = function ( node ) {
333349 var tokens = TextParser . parse ( node . nodeValue )
334350 if ( ! tokens ) return
335- var dirname = config . attrs . text ,
336- el , token , directive
351+ var el , token , directive
337352 for ( var i = 0 , l = tokens . length ; i < l ; i ++ ) {
338353 token = tokens [ i ]
339354 if ( token . key ) { // a binding
@@ -346,7 +361,7 @@ CompilerProto.compileTextNode = function (node) {
346361 }
347362 } else { // a binding
348363 el = document . createTextNode ( '' )
349- directive = Directive . parse ( dirname , token . key , this , el )
364+ directive = Directive . parse ( 'text' , token . key , this , el )
350365 if ( directive ) {
351366 this . bindDirective ( directive )
352367 }
0 commit comments