Skip to content

Commit

Permalink
fix typo and change if statements slightly (better minification)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbest committed Mar 23, 2012
1 parent 31d1857 commit 5051ea6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/templating/templateEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = function (script
ko.templateEngine.prototype['makeTemplateSource'] = function(template, templateDocument) {
// Named template
if (typeof template == "string") {
templateDocument = nodeDocument || document;
templateDocument = templateDocument || document;
var elem = templateDocument.getElementById(template);
if (!elem)
throw new Error("Cannot find template with ID " + template);
Expand All @@ -60,7 +60,7 @@ ko.templateEngine.prototype['isTemplateRewritten'] = function (template, templat
return true;

// Perf optimisation - see below
if ((!templateDocument || templateDocument === document) && this.knownRewrittenTemplates && this.knownRewrittenTemplates[template])
if (!(templateDocument && templateDocument == document) && this.knownRewrittenTemplates && this.knownRewrittenTemplates[template])
return true;

return this['makeTemplateSource'](template, templateDocument)['data']("isRewritten");
Expand All @@ -74,7 +74,7 @@ ko.templateEngine.prototype['rewriteTemplate'] = function (template, rewriterCal

// Perf optimisation - for named templates, track which ones have been rewritten so we can
// answer 'isTemplateRewritten' *without* having to use getElementById (which is slow on IE < 8)
if ((!templateDocument || templateDocument === document) && typeof template == "string") {
if (!(templateDocument && templateDocument == document) && typeof template == "string") {
this.knownRewrittenTemplates = this.knownRewrittenTemplates || {};
this.knownRewrittenTemplates[template] = true;
}
Expand Down

0 comments on commit 5051ea6

Please sign in to comment.