From 10adbaf4fe2ed632739010ebe2235d8fbafc2089 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Thu, 29 Oct 2009 16:56:20 -0400 Subject: [PATCH] Hit a snafu when in the browser. --- mustache.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mustache.js b/mustache.js index b0ad601..55b36c1 100644 --- a/mustache.js +++ b/mustache.js @@ -164,8 +164,11 @@ var Mustache = function() { while(parts.length) { p = parts.shift(); if(ctx[p] === undefined) { - src = context.toSource(); - src = src.replace(/^\(|\)$/g, ""); + if(typeof(context.toSource) == "function") { + src = context.toSource().replace(/^\(|\)$/g, ""); + } else { + src = context.toString(); + } throw({message: "'" + name + "' not found in context: " + src}); } ctx = ctx[p];