@@ -11,6 +11,7 @@ var resolveAsset = _.resolveAsset
11
11
// special binding prefixes
12
12
var bindRE = / ^ b i n d - | ^ : /
13
13
var onRE = / ^ o n - /
14
+ var specialAttrRE = / ^ ( b i n d - | : ) ? ( e l | t r a n s i t i o n ) $ /
14
15
15
16
// terminal directives
16
17
var terminalDirectives = [
@@ -565,37 +566,31 @@ function compileDirectives (attrs, options) {
565
566
}
566
567
} else
567
568
568
- // special case for el
569
- if ( name === 'el' || name === 'bind-el' ) {
570
- pushDir ( 'el ' , internalDirectives . el , {
571
- literal : ! bindRE . test ( name )
569
+ // event handlers
570
+ if ( onRE . test ( name ) ) {
571
+ pushDir ( 'on ' , internalDirectives . on , {
572
+ arg : name . replace ( onRE , '' )
572
573
} )
573
574
} else
574
575
575
- // special case for transition
576
- if ( name === 'transition' || name === 'bind-transition' ) {
577
- pushDir ( 'transition' , internalDirectives . transition , {
576
+ // special attribtues: transition & el
577
+ if ( specialAttrRE . test ( name ) ) {
578
+ dirName = name . replace ( bindRE , '' )
579
+ pushDir ( dirName , internalDirectives [ dirName ] , {
578
580
literal : ! bindRE . test ( name )
579
581
} )
580
582
} else
581
583
582
584
// attribute bindings
583
585
if ( bindRE . test ( name ) ) {
584
- var attributeName = name . replace ( bindRE , '' )
585
- if ( attributeName === 'style' || attributeName === 'class' ) {
586
- pushDir ( attributeName , internalDirectives [ attributeName ] )
586
+ dirName = name . replace ( bindRE , '' )
587
+ if ( dirName === 'style' || dirName === 'class' ) {
588
+ pushDir ( dirName , internalDirectives [ dirName ] )
587
589
} else {
588
590
pushDir ( 'attr' , internalDirectives . attr , {
589
- arg : attributeName
591
+ arg : dirName
590
592
} )
591
593
}
592
- } else
593
-
594
- // event handlers
595
- if ( onRE . test ( name ) ) {
596
- pushDir ( 'on' , internalDirectives . on , {
597
- arg : name . replace ( onRE , '' )
598
- } )
599
594
}
600
595
}
601
596
0 commit comments