-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated with fix for EJS templates rendering as document fragments #37
Conversation
@@ -171,5 +751,22 @@ deepAssign($view, { | |||
} | |||
}); | |||
|
|||
$view.register({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This register should be done in can-ejs
|
||
// If we are `async`... | ||
if (async) { | ||
// Return the deferred |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should warn that this is not supported
var getRenderer = function (obj, async) { | ||
// If `obj` already is a renderer function just resolve a Deferred with it | ||
if(isFunction(obj)) { | ||
var def = can.Deferred(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use https://github.com/canjs/canjs/blob/2.3-legacy/util/deferred.js for deferred.
} else { | ||
// Make an ajax request for text. | ||
var d = new can.Deferred(); | ||
jQuery.ajax({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can.ajax
support async: false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to update https://github.com/canjs/can-ajax both 1.X and 2.X versions with this.
renderer = makeRenderer( info.renderer(id, text) ); | ||
} | ||
|
||
def = def || new can.Deferred(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
then: function(){ return renderer },
state: function(){ return "resolved" }
}
*/ | ||
renderTo: function(format, renderer, data, helpers, nodelist){ | ||
if (format === "string") { | ||
if (renderer.renderAsString) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will check for the actual string renderer now, which is provided by ejs
here:
https://github.com/canjs/can-ejs/pull/67/files#diff-d693f1cbebb75316de0f7e3e21837a56R23
|
Closing in favor of #38 (same but with extra fixes). |
Update of PR #37 to support EJS templates rendering as strings.
Worked with @justinbmeyer to come up with a solution to the [Object DocumentFragment] string being displayed on some instances where EJS was being used.