mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Put knockout bind context Proxy outside bindingFunction
This commit is contained in:
parent
3d55bdaf5a
commit
c744b83480
3 changed files with 52 additions and 53 deletions
18
vendors/knockout/src/binding/bindingProvider.js
vendored
18
vendors/knockout/src/binding/bindingProvider.js
vendored
|
|
@ -50,17 +50,17 @@ ko.bindingProvider = new class
|
|||
// Build the source for a function that evaluates "expression"
|
||||
// Use one "with" that has one secure scope handling Proxy
|
||||
// Deprecated: with is no longer recommended
|
||||
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString),
|
||||
functionBody = "$context = new Proxy(\
|
||||
$context,\
|
||||
{\
|
||||
has: () => true,\
|
||||
get: (target, key) => target[key] || target['$data'][key]\
|
||||
}\
|
||||
);with($context){return{" + rewrittenBindings + "}}";
|
||||
bindingFunction = new Function("$context", functionBody);
|
||||
bindingFunction = new Function("$context",
|
||||
"with($context){return{" + ko.expressionRewriting.preProcessBindings(bindingsString) + "}}");
|
||||
bindingCache.set(cacheKey, bindingFunction);
|
||||
}
|
||||
bindingContext = new Proxy(
|
||||
bindingContext,
|
||||
{
|
||||
has: () => true,
|
||||
get: (target, key) => target[key] || target['$data'][key]
|
||||
}
|
||||
);
|
||||
return bindingFunction(bindingContext);
|
||||
} catch (ex) {
|
||||
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue