Parcourir la source

Bugfix for view context cache picking methods from Object.prototype instead of the view.

Fixes #442
tags/v2.1.0
Phillip Johnsen il y a 11 ans
Parent
révision
e801e842a7
4 fichiers modifiés avec 7 ajouts et 1 suppressions
  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 Voir le fichier

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

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


+ 4
- 0
test/_files/avoids_obj_prototype_in_view_cache.js Voir le fichier

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

+ 1
- 0
test/_files/avoids_obj_prototype_in_view_cache.mustache Voir le fichier

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

+ 1
- 0
test/_files/avoids_obj_prototype_in_view_cache.txt Voir le fichier

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

Chargement…
Annuler
Enregistrer