Selaa lähdekoodia

Add support for resolving template functions using object prototype instead of current view object

pull/514/head
Brook Zhou 10 vuotta sitten
vanhempi
commit
b5fffe9c1e
1 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. +7
    -2
      mustache.js

+ 7
- 2
mustache.js Näytä tiedosto

@@ -414,8 +414,13 @@
cache[name] = value;
}

if (isFunction(value))
value = value.call(this.view);
if (isFunction(value)){
if (names && names.length > 1 && typeof Object.getPrototypeOf(names[names.length-2])[names[names.length-1]] === 'function'){
value = value.call(names[names.length-2]);
} else {
value = value.call(this.view);
}
}

return value;
};


Loading…
Peruuta
Tallenna