mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fixed handling of include attribute
This commit is contained in:
parent
6e9ca3d723
commit
a3a179da8d
@ -164,11 +164,16 @@ var coreAttrHandlers = [
|
|||||||
'include', function(attr, node, el) {
|
'include', function(attr, node, el) {
|
||||||
var context = this.context;
|
var context = this.context;
|
||||||
|
|
||||||
if (attr.argument) {
|
if (typeof attr.argument === 'string') {
|
||||||
var includeNode = context.createNodeForEl('include', null, attr.argument);
|
if (attr.argument) {
|
||||||
node.appendChild(includeNode);
|
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 {
|
} else {
|
||||||
context.addError(el, 'The include attribute must have an argument. For example: include("./target.marko") or include(data.renderBody)');
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
1
test/autotests/render/include-attr-no-arg/expected.html
Normal file
1
test/autotests/render/include-attr-no-arg/expected.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div include="123"></div>
|
||||||
1
test/autotests/render/include-attr-no-arg/template.marko
Normal file
1
test/autotests/render/include-attr-no-arg/template.marko
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div include="123"/>
|
||||||
1
test/autotests/render/include-attr-no-arg/test.js
Normal file
1
test/autotests/render/include-attr-no-arg/test.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
exports.templateData = {};
|
||||||
Loading…
x
Reference in New Issue
Block a user