move terminal directives list to config

This commit is contained in:
Evan You 2015-05-08 21:57:31 -04:00
parent f7e571c468
commit a439fa2722
2 changed files with 19 additions and 13 deletions

View File

@ -494,29 +494,24 @@ function makeParamsLinkFn (params, options) {
* @return {Function} terminalLinkFn
*/
var terminalDirectives = [
'repeat',
'if',
'component'
]
function skip () {}
skip.terminal = true
function checkTerminalDirectives (el, options) {
if (_.attr(el, 'pre') !== null) {
return skip
}
var value, dirName
var dirs = config._terminalDirectives
/* jshint boss: true */
for (var i = 0; i < 3; i++) {
dirName = terminalDirectives[i]
if (value = _.attr(el, dirName)) {
for (var i = 0, l = dirs.length; i < l; i++) {
dirName = dirs[i]
if ((value = _.attr(el, dirName)) !== null) {
return makeTerminalNodeLinkFn(el, dirName, value, options)
}
}
}
function skip () {}
skip.terminal = true
/**
* Build a node link function for a terminal directive.
* A terminal link function terminates the current

View File

@ -62,7 +62,18 @@ module.exports = {
* @type {Boolean}
*/
_delimitersChanged: true
_delimitersChanged: true,
/**
* List of directives that are "terminal", i.e. handles
* the compilation of its own content
*/
_terminalDirectives: [
'repeat',
'if',
'component'
]
}