@@ -315,9 +315,10 @@ function compileElement (el, options) {
315
315
}
316
316
var linkFn
317
317
var hasAttrs = el . hasAttributes ( )
318
+ var attrs = hasAttrs && toArray ( el . attributes )
318
319
// check terminal directives (for & if)
319
320
if ( hasAttrs ) {
320
- linkFn = checkTerminalDirectives ( el , options )
321
+ linkFn = checkTerminalDirectives ( el , attrs , options )
321
322
}
322
323
// check element directives
323
324
if ( ! linkFn ) {
@@ -329,7 +330,7 @@ function compileElement (el, options) {
329
330
}
330
331
// normal directives
331
332
if ( ! linkFn && hasAttrs ) {
332
- linkFn = compileDirectives ( el . attributes , options )
333
+ linkFn = compileDirectives ( attrs , options )
333
334
}
334
335
return linkFn
335
336
}
@@ -567,11 +568,12 @@ function checkComponent (el, options) {
567
568
* If it finds one, return a terminal link function.
568
569
*
569
570
* @param {Element } el
571
+ * @param {Array } attrs
570
572
* @param {Object } options
571
573
* @return {Function } terminalLinkFn
572
574
*/
573
575
574
- function checkTerminalDirectives ( el , options ) {
576
+ function checkTerminalDirectives ( el , attrs , options ) {
575
577
// skip v-pre
576
578
if ( getAttr ( el , 'v-pre' ) !== null ) {
577
579
return skip
@@ -584,8 +586,7 @@ function checkTerminalDirectives (el, options) {
584
586
}
585
587
}
586
588
587
- var attrs , attr , name , value , matched , dirName , arg , def , termDef
588
- attrs = el . attributes
589
+ var attr , name , value , matched , dirName , arg , def , termDef
589
590
for ( var i = 0 , j = attrs . length ; i < j ; i ++ ) {
590
591
attr = attrs [ i ]
591
592
if ( ( matched = attr . name . match ( dirAttrRE ) ) ) {
0 commit comments