Bugfix: compose mail select contacts for cc/bcc failed

Cleanup: Inputosaurus and Knockout
Change: Knockout domData now uses WeakMap
Replaced: Knockout domManipulation with a documentFragment
This commit is contained in:
djmaze 2021-02-01 14:34:24 +01:00
parent fe7c7fede4
commit ebe2c0536f
23 changed files with 410 additions and 889 deletions

View file

@ -38,6 +38,3 @@ ko.bindingHandlers['hasfocus'] = {
}
};
ko.expressionRewriting.twoWayBindings['hasfocus'] = true;
ko.bindingHandlers['hasFocus'] = ko.bindingHandlers['hasfocus']; // Make "hasFocus" an alias
ko.expressionRewriting.twoWayBindings['hasFocus'] = 'hasfocus';

View file

@ -3,7 +3,20 @@ ko.bindingHandlers['html'] = {
// Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
return { 'controlsDescendantBindings': true };
},
'update': (element, valueAccessor) =>
'update': (element, valueAccessor) => {
// setHtml will unwrap the value if needed
ko.utils.setHtml(element, valueAccessor())
ko.utils.emptyDomNode(element);
// There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it
let html = ko.utils.unwrapObservable(valueAccessor());
if (html != null) {
if (typeof html != 'string')
html = html.toString();
const template = document.createElement('template');
template.innerHTML = html;
element.appendChild(template.content);
}
}
};