Fixed handling of include attribute

This commit is contained in:
Patrick Steele-Idem 2017-01-31 19:01:06 -07:00
parent 6e9ca3d723
commit a3a179da8d
4 changed files with 12 additions and 4 deletions

View File

@ -164,12 +164,17 @@ var coreAttrHandlers = [
'include', function(attr, node, el) {
var context = this.context;
if (typeof attr.argument === 'string') {
if (attr.argument) {
var includeNode = context.createNodeForEl('include', null, attr.argument);
node.appendChild(includeNode);
} else {
context.addError(el, 'The include attribute must have an argument. For example: include("./target.marko") or include(data.renderBody)');
}
} else {
return false;
}
}
]
];

View File

@ -0,0 +1 @@
<div include="123"></div>

View File

@ -0,0 +1 @@
<div include="123"/>

View File

@ -0,0 +1 @@
exports.templateData = {};