Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Put knockout bind context Proxy outside bindingFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Oct 29, 2024
1 parent 3d55bda commit c744b83
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 53 deletions.
18 changes: 9 additions & 9 deletions vendors/knockout/build/output/knockout-latest.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -1636,17 +1636,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
Expand Down
Loading

0 comments on commit c744b83

Please sign in to comment.