@@ -315,9 +315,10 @@ function compileElement (el, options) {
315315 }
316316 var linkFn
317317 var hasAttrs = el . hasAttributes ( )
318+ var attrs = hasAttrs && toArray ( el . attributes )
318319 // check terminal directives (for & if)
319320 if ( hasAttrs ) {
320- linkFn = checkTerminalDirectives ( el , options )
321+ linkFn = checkTerminalDirectives ( el , attrs , options )
321322 }
322323 // check element directives
323324 if ( ! linkFn ) {
@@ -329,7 +330,7 @@ function compileElement (el, options) {
329330 }
330331 // normal directives
331332 if ( ! linkFn && hasAttrs ) {
332- linkFn = compileDirectives ( el . attributes , options )
333+ linkFn = compileDirectives ( attrs , options )
333334 }
334335 return linkFn
335336}
@@ -567,11 +568,12 @@ function checkComponent (el, options) {
567568 * If it finds one, return a terminal link function.
568569 *
569570 * @param {Element } el
571+ * @param {Array } attrs
570572 * @param {Object } options
571573 * @return {Function } terminalLinkFn
572574 */
573575
574- function checkTerminalDirectives ( el , options ) {
576+ function checkTerminalDirectives ( el , attrs , options ) {
575577 // skip v-pre
576578 if ( getAttr ( el , 'v-pre' ) !== null ) {
577579 return skip
@@ -584,8 +586,7 @@ function checkTerminalDirectives (el, options) {
584586 }
585587 }
586588
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
589590 for ( var i = 0 , j = attrs . length ; i < j ; i ++ ) {
590591 attr = attrs [ i ]
591592 if ( ( matched = attr . name . match ( dirAttrRE ) ) ) {
0 commit comments