mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
KnockoutJS scramble controlsDescendantBindings
This commit is contained in:
parent
4ee00d30ae
commit
667e50c9fb
6 changed files with 6 additions and 6 deletions
|
|
@ -380,7 +380,7 @@ function applyBindingsToNodeInternal(node, sourceBindings, bindingContext) {
|
||||||
var initResult = handlerInitFn(node, getValueAccessor(bindingKey), allBindings, contextToExtend['$data'], contextToExtend);
|
var initResult = handlerInitFn(node, getValueAccessor(bindingKey), allBindings, contextToExtend['$data'], contextToExtend);
|
||||||
|
|
||||||
// If this binding handler claims to control descendant bindings, make a note of this
|
// If this binding handler claims to control descendant bindings, make a note of this
|
||||||
if (initResult && initResult['controlsDescendantBindings']) {
|
if (initResult && initResult.controlsDescendantBindings) {
|
||||||
if (bindingHandlerThatControlsDescendantBindings !== undefined)
|
if (bindingHandlerThatControlsDescendantBindings !== undefined)
|
||||||
throw new Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
|
throw new Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
|
||||||
bindingHandlerThatControlsDescendantBindings = bindingKey;
|
bindingHandlerThatControlsDescendantBindings = bindingKey;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ko.bindingHandlers['html'] = {
|
ko.bindingHandlers['html'] = {
|
||||||
'init': () => (
|
'init': () => (
|
||||||
// Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
|
// Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
|
||||||
{ 'controlsDescendantBindings': true }
|
{ controlsDescendantBindings: true }
|
||||||
),
|
),
|
||||||
'update': (element, valueAccessor) => {
|
'update': (element, valueAccessor) => {
|
||||||
// setHtml will unwrap the value if needed
|
// setHtml will unwrap the value if needed
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ function makeWithIfBinding(bindingKey, isWith, isNot) {
|
||||||
|
|
||||||
}, { disposeWhenNodeIsRemoved: element });
|
}, { disposeWhenNodeIsRemoved: element });
|
||||||
|
|
||||||
return { 'controlsDescendantBindings': true };
|
return { controlsDescendantBindings: true };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ko.virtualElements.allowedBindings[bindingKey] = true;
|
ko.virtualElements.allowedBindings[bindingKey] = true;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ ko.bindingHandlers['options'] = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensures that the binding processor doesn't try to bind the options
|
// Ensures that the binding processor doesn't try to bind the options
|
||||||
return { 'controlsDescendantBindings': true };
|
return { controlsDescendantBindings: true };
|
||||||
},
|
},
|
||||||
'update': (element, valueAccessor, allBindings) => {
|
'update': (element, valueAccessor, allBindings) => {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ ko.bindingHandlers['text'] = {
|
||||||
'init': () => (
|
'init': () => (
|
||||||
// Prevent binding on the dynamically-injected text node (as developers are unlikely to expect that, and it has security implications).
|
// Prevent binding on the dynamically-injected text node (as developers are unlikely to expect that, and it has security implications).
|
||||||
// It should also make things faster, as we no longer have to consider whether the text node might be bindable.
|
// It should also make things faster, as we no longer have to consider whether the text node might be bindable.
|
||||||
{ 'controlsDescendantBindings': true }
|
{ controlsDescendantBindings: true }
|
||||||
),
|
),
|
||||||
'update': (element, valueAccessor) => {
|
'update': (element, valueAccessor) => {
|
||||||
if (8 === element.nodeType) {
|
if (8 === element.nodeType) {
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
});
|
});
|
||||||
}, { disposeWhenNodeIsRemoved: element });
|
}, { disposeWhenNodeIsRemoved: element });
|
||||||
|
|
||||||
return { 'controlsDescendantBindings': true };
|
return { controlsDescendantBindings: true };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue