@@ -194,8 +194,10 @@ function compileElement (el, options) {
194
194
}
195
195
var linkFn
196
196
var hasAttrs = el . hasAttributes ( )
197
+ // check element directives
198
+ linkFn = checkElementDirectives ( el , options )
197
199
// check terminal direcitves (repeat & if)
198
- if ( hasAttrs ) {
200
+ if ( ! linkFn && hasAttrs ) {
199
201
linkFn = checkTerminalDirectives ( el , options )
200
202
}
201
203
// check component
@@ -444,6 +446,22 @@ function makePropsLinkFn (props) {
444
446
}
445
447
}
446
448
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
+
447
465
/**
448
466
* Check if an element is a component. If yes, return
449
467
* a component link function.
@@ -503,12 +521,13 @@ skip.terminal = true
503
521
* @param {String } dirName
504
522
* @param {String } value
505
523
* @param {Object } options
524
+ * @param {Object } [def]
506
525
* @return {Function } terminalLinkFn
507
526
*/
508
527
509
- function makeTerminalNodeLinkFn ( el , dirName , value , options ) {
528
+ function makeTerminalNodeLinkFn ( el , dirName , value , options , def ) {
510
529
var descriptor = dirParser . parse ( value ) [ 0 ]
511
- var def = options . directives [ dirName ]
530
+ def = def || options . directives [ dirName ]
512
531
var fn = function terminalNodeLinkFn ( vm , el , host ) {
513
532
vm . _bindDir ( dirName , el , descriptor , def , host )
514
533
}
0 commit comments