mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Merge branch 'v1.0'
Conflicts: package.json
This commit is contained in:
commit
54409d9e2e
@ -49,12 +49,15 @@ function Template(renderFunc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Template.prototype = {
|
Template.prototype = {
|
||||||
render: function(data, callback, context) {
|
render: function(data, context) {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
data = {};
|
data = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof callback === 'function') {
|
var callback;
|
||||||
|
|
||||||
|
if (typeof context === 'function') {
|
||||||
|
callback = context;
|
||||||
context = new Context();
|
context = new Context();
|
||||||
|
|
||||||
context
|
context
|
||||||
@ -67,11 +70,17 @@ Template.prototype = {
|
|||||||
|
|
||||||
context.end();
|
context.end();
|
||||||
} else {
|
} else {
|
||||||
|
var shouldEnd = false;
|
||||||
|
if (!context) {
|
||||||
|
context = new Context();
|
||||||
|
shouldEnd = true;
|
||||||
|
}
|
||||||
// A context object was provided instead of a callback
|
// A context object was provided instead of a callback
|
||||||
context = callback;
|
|
||||||
callback = null;
|
|
||||||
|
|
||||||
this._(data, context); //Invoke the template rendering function with the required arguments
|
this._(data, context); //Invoke the template rendering function with the required arguments
|
||||||
|
|
||||||
|
if (shouldEnd) {
|
||||||
|
context.end();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
|
|||||||
@ -281,6 +281,9 @@ module.exports = function transform(node, compiler, template) {
|
|||||||
},
|
},
|
||||||
'c-input': function(attr) {
|
'c-input': function(attr) {
|
||||||
inputAttr = attr.value;
|
inputAttr = attr.value;
|
||||||
|
},
|
||||||
|
'c-data': function(attr) {
|
||||||
|
inputAttr = attr.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user