KnockoutJS drop the twoWayBindings code

This commit is contained in:
the-djmaze 2024-03-03 16:49:52 +01:00
parent df8f13e359
commit 4af874e1d1
5 changed files with 1 additions and 16 deletions

View file

@ -113,7 +113,6 @@ ko.bindingHandlers['checked'] = {
}
}
};
//ko.expressionRewriting.twoWayBindings['checked'] = true;
ko.bindingHandlers['checkedValue'] = {
'update'(element, valueAccessor) {

View file

@ -36,4 +36,3 @@ ko.bindingHandlers['hasfocus'] = {
}
}
};
//ko.expressionRewriting.twoWayBindings.add('hasfocus');

View file

@ -51,7 +51,6 @@ ko.bindingHandlers['textInput'] = {
ko.computed(updateView, { disposeWhenNodeIsRemoved: element });
}
};
//ko.expressionRewriting.twoWayBindings.add('textInput');
// textinput is an alias for textInput
ko.bindingHandlers['textinput'] = {

View file

@ -112,4 +112,3 @@ ko.bindingHandlers['value'] = {
},
'update': () => {} // Keep for backwards compatibility with code that may have wrapped value binding
};
//ko.expressionRewriting.twoWayBindings.add('value');

View file

@ -112,9 +112,6 @@ ko.expressionRewriting = (() => {
return result;
},
// Two-way bindings include a write function that allow the handler to update the value even if it's not an observable.
// twoWayBindings = new Set,
preProcessBindings = (bindingsStringOrKeyValueArray) => {
var resultStrings = [],
@ -125,13 +122,7 @@ ko.expressionRewriting = (() => {
var /*writableVal,*/ obj = ko.bindingHandlers[key];
if (obj?.['preprocess'] && !obj['preprocess'](val, key, processKeyValue))
return;
/*
if (twoWayBindings.has(key) && (writableVal = getWriteableValue(val))) {
// For two-way bindings, provide a write method in case the value
// isn't a writable observable.
propertyAccessorResultStrings.push("'" + key + "':function(_z){" + writableVal + "=_z}");
}
*/
// Values are wrapped in a function so that each value can be accessed independently
val = 'function(){return ' + val + ' }';
resultStrings.push("'" + key + "':" + val);
@ -148,8 +139,6 @@ ko.expressionRewriting = (() => {
};
return {
// twoWayBindings: twoWayBindings,
parseObjectLiteral: parseObjectLiteral,
preProcessBindings: preProcessBindings,