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

Merge pull request #461 from janl/fix/context-cache

Bugfix for view context cache
tags/v2.1.0
David da Silva Contín 11 лет назад
Родитель
Сommit
15e7016895
4 измененных файлов: 7 добавлений и 1 удалений
  1. +1
    -1
      mustache.js
  2. +4
    -0
      test/_files/avoids_obj_prototype_in_view_cache.js
  3. +1
    -0
      test/_files/avoids_obj_prototype_in_view_cache.mustache
  4. +1
    -0
      test/_files/avoids_obj_prototype_in_view_cache.txt

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

@@ -356,7 +356,7 @@
var cache = this.cache; var cache = this.cache;


var value; var value;
if (name in cache) {
if (cache.hasOwnProperty(name)) {
value = cache[name]; value = cache[name];
} else { } else {
var context = this, names, index, lookupHit = false; var context = this, names, index, lookupHit = false;


+ 4
- 0
test/_files/avoids_obj_prototype_in_view_cache.js Просмотреть файл

@@ -0,0 +1,4 @@
({
valueOf: 'Avoids methods',
watch: 'in Object.prototype'
})

+ 1
- 0
test/_files/avoids_obj_prototype_in_view_cache.mustache Просмотреть файл

@@ -0,0 +1 @@
{{valueOf}} {{watch}}

+ 1
- 0
test/_files/avoids_obj_prototype_in_view_cache.txt Просмотреть файл

@@ -0,0 +1 @@
Avoids methods in Object.prototype

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