@@ -194,8 +194,10 @@ function compileElement (el, options) {
194194 }
195195 var linkFn
196196 var hasAttrs = el . hasAttributes ( )
197+ // check element directives
198+ linkFn = checkElementDirectives ( el , options )
197199 // check terminal direcitves (repeat & if)
198- if ( hasAttrs ) {
200+ if ( ! linkFn && hasAttrs ) {
199201 linkFn = checkTerminalDirectives ( el , options )
200202 }
201203 // check component
@@ -444,6 +446,22 @@ function makePropsLinkFn (props) {
444446 }
445447}
446448
449+ /**
450+ * Check for element directives (custom elements that should
451+ * be resovled as terminal directives).
452+ *
453+ * @param {Element } el
454+ * @param {Object } options
455+ */
456+
457+ function checkElementDirectives ( el , options ) {
458+ var tag = el . tagName . toLowerCase ( )
459+ var def = options . elementDirectives [ tag ]
460+ if ( def ) {
461+ return makeTerminalNodeLinkFn ( el , tag , '' , options , def )
462+ }
463+ }
464+
447465/**
448466 * Check if an element is a component. If yes, return
449467 * a component link function.
@@ -503,12 +521,13 @@ skip.terminal = true
503521 * @param {String } dirName
504522 * @param {String } value
505523 * @param {Object } options
524+ * @param {Object } [def]
506525 * @return {Function } terminalLinkFn
507526 */
508527
509- function makeTerminalNodeLinkFn ( el , dirName , value , options ) {
528+ function makeTerminalNodeLinkFn ( el , dirName , value , options , def ) {
510529 var descriptor = dirParser . parse ( value ) [ 0 ]
511- var def = options . directives [ dirName ]
530+ def = def || options . directives [ dirName ]
512531 var fn = function terminalNodeLinkFn ( vm , el , host ) {
513532 vm . _bindDir ( dirName , el , descriptor , def , host )
514533 }
0 commit comments