Просмотр исходного кода

mustache compat: Don't barf on unknown variables.

tags/0.2
Jan Lehnardt 16 лет назад
Родитель
Сommit
0bb4776def
3 измененных файлов: 4 добавлений и 3 удалений
  1. +1
    -1
      examples/error_not_found.txt
  2. +2
    -1
      mustache.js
  3. +1
    -1
      test/mustache_spec.rb

+ 1
- 1
examples/error_not_found.txt Просмотреть файл

@@ -1 +1 @@
ERROR: 'foo' not found in context

+ 2
- 1
mustache.js Просмотреть файл

@@ -158,7 +158,8 @@ var Mustache = function() {
if(context[name] !== undefined) { if(context[name] !== undefined) {
return context[name]; return context[name];
} }
throw({message: "'" + name + "' not found in context"});
// silently ignore unkown variables
return "";
}, },


// Utility methods // Utility methods


+ 1
- 1
test/mustache_spec.rb Просмотреть файл

@@ -37,7 +37,7 @@ describe "mustache" do
print('ERROR: ' + e.message); print('ERROR: ' + e.message);
} }
JS JS
run_js(js).should == "ERROR: 'x' not found in context\n"
run_js(js).should == "\n"
end end
non_partials.each do |testname| non_partials.each do |testname|


Загрузка…
Отмена
Сохранить