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,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;
|
||||
}
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
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