mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-24 23:08:08 +08:00
KnockoutJS simplify virtualElements binding check
This commit is contained in:
parent
4af874e1d1
commit
33f0dfd3b2
1 changed files with 3 additions and 8 deletions
|
@ -216,12 +216,6 @@ ko.bindingEvent = {
|
|||
}
|
||||
};
|
||||
|
||||
function validateThatBindingIsAllowedForVirtualElements(bindingName) {
|
||||
var validator = ko.virtualElements.allowedBindings[bindingName];
|
||||
if (!validator)
|
||||
throw new Error("The binding '" + bindingName + "' cannot be used with virtual elements")
|
||||
}
|
||||
|
||||
function applyBindingsToDescendantsInternal(bindingContext, elementOrVirtualElement) {
|
||||
var currentChild, nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);
|
||||
|
||||
|
@ -374,8 +368,9 @@ function applyBindingsToNodeInternal(node, sourceBindings, bindingContext) {
|
|||
handlerUpdateFn = bindingKeyAndHandler.handler["update"],
|
||||
bindingKey = bindingKeyAndHandler.key;
|
||||
|
||||
if (node.nodeType === 8) {
|
||||
validateThatBindingIsAllowedForVirtualElements(bindingKey);
|
||||
// COMMENT_NODE
|
||||
if (node.nodeType === 8 && !ko.virtualElements.allowedBindings[bindingKey]) {
|
||||
throw new Error("The binding '" + bindingKey + "' cannot be used with comment nodes");
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue