Permalink
Browse files

fix typo and change if statements slightly (better minification)

  • Loading branch information...
mbest committed Mar 23, 2012
1 parent 31d1857 commit 5051ea6213db469d22eb30a09186e404a8bf34cc
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/templating/templateEngine.js
@@ -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);
@@ -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");
@@ -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;
}

0 comments on commit 5051ea6

Please sign in to comment.