diff --git a/demo/mustache.html b/demo/mustache.html
index ecc68555efb2a398d3c8a3bdc2589a570e25c42f..ae4e6a891bbd2513c0974eca9c4737425a8a74e1 100644
--- a/demo/mustache.html
+++ b/demo/mustache.html
@@ -46,9 +46,10 @@ CodeMirror.defineMode("mustache", function(config, parserConfig) {
       var ch;
       if (stream.match("{{")) {
         while ((ch = stream.next()) != null)
-          if (ch == "}" && stream.next() == "}") break;
-        stream.eat("}");
-        return "mustache";
+          if (ch == "}" && stream.next() == "}") {
+            stream.eat("}");
+            return "mustache";
+          }
       }
       while (stream.next() != null && !stream.match("{{", false)) {}
       return null;