Explorar el Código

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

pull/514/head
Brook Zhou hace 10 años
padre
commit
b5fffe9c1e
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. +7
    -2
      mustache.js

+ 7
- 2
mustache.js Ver fichero

@@ -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;
};


Cargando…
Cancelar
Guardar