mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-08 22:18:28 +03:00
KnockoutJS drop unused bindingRewriteValidators
This commit is contained in:
parent
0f0f60e456
commit
df8f13e359
4 changed files with 0 additions and 16 deletions
|
|
@ -25,5 +25,4 @@ ko.bindingHandlers['foreach'] = {
|
|||
'update': (element, valueAccessor, allBindings, viewModel, bindingContext) =>
|
||||
ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindings, viewModel, bindingContext)
|
||||
};
|
||||
ko.expressionRewriting.bindingRewriteValidators['foreach'] = false; // Can't rewrite control flow bindings
|
||||
ko.virtualElements.allowedBindings['foreach'] = true;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ function makeWithIfBinding(bindingKey, isWith, isNot) {
|
|||
return { 'controlsDescendantBindings': true };
|
||||
}
|
||||
};
|
||||
ko.expressionRewriting.bindingRewriteValidators[bindingKey] = false; // Can't rewrite control flow bindings
|
||||
ko.virtualElements.allowedBindings[bindingKey] = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,8 +148,6 @@ ko.expressionRewriting = (() => {
|
|||
};
|
||||
|
||||
return {
|
||||
bindingRewriteValidators: [],
|
||||
|
||||
// twoWayBindings: twoWayBindings,
|
||||
|
||||
parseObjectLiteral: parseObjectLiteral,
|
||||
|
|
|
|||
12
vendors/knockout/src/templating/templating.js
vendored
12
vendors/knockout/src/templating/templating.js
vendored
|
|
@ -259,17 +259,5 @@
|
|||
}
|
||||
};
|
||||
|
||||
// Anonymous templates can't be rewritten. Give a nice error message if you try to do it.
|
||||
ko.expressionRewriting.bindingRewriteValidators['template'] = bindingValue => {
|
||||
var parsedBindingValue = ko.expressionRewriting.parseObjectLiteral(bindingValue);
|
||||
|
||||
if ((parsedBindingValue.length == 1) && parsedBindingValue[0]['unknown'])
|
||||
return null; // It looks like a string literal, not an object literal, so treat it as a named template (which is allowed for rewriting)
|
||||
|
||||
if (ko.expressionRewriting.keyValueArrayContainsKey(parsedBindingValue, "name"))
|
||||
return null; // Named templates can be rewritten, so return "no error"
|
||||
return "This template engine does not support anonymous templates nested within its templates";
|
||||
};
|
||||
|
||||
ko.virtualElements.allowedBindings['template'] = true;
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue