mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
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:
parent
fe7c7fede4
commit
ebe2c0536f
23 changed files with 410 additions and 889 deletions
75
vendors/knockout/src/binding/bindingProvider.js
vendored
75
vendors/knockout/src/binding/bindingProvider.js
vendored
|
|
@ -1,34 +1,26 @@
|
|||
(function() {
|
||||
var defaultBindingAttributeName = "data-bind";
|
||||
(() => {
|
||||
const defaultBindingAttributeName = "data-bind",
|
||||
|
||||
ko.bindingProvider = function() {
|
||||
this.bindingCache = {};
|
||||
};
|
||||
bindingCache = {},
|
||||
|
||||
ko.utils.extend(ko.bindingProvider.prototype, {
|
||||
'nodeHasBindings': node => {
|
||||
switch (node.nodeType) {
|
||||
case 1: // Element
|
||||
return node.getAttribute(defaultBindingAttributeName) != null;
|
||||
case 8: // Comment node
|
||||
return ko.virtualElements.hasBindingValue(node);
|
||||
default: return false;
|
||||
}
|
||||
createBindingsStringEvaluatorViaCache = (bindingsString, cache, options) => {
|
||||
var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
|
||||
return cache[cacheKey]
|
||||
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
|
||||
},
|
||||
|
||||
'getBindings': function(node, bindingContext) {
|
||||
var bindingsString = this['getBindingsString'](node, bindingContext);
|
||||
return bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node) : null;
|
||||
},
|
||||
|
||||
'getBindingAccessors': function(node, bindingContext) {
|
||||
var bindingsString = this['getBindingsString'](node, bindingContext);
|
||||
return bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
|
||||
createBindingsStringEvaluator = (bindingsString, options) => {
|
||||
// Build the source for a function that evaluates "expression"
|
||||
// For each scope variable, add an extra level of "with" nesting
|
||||
// Example result: with(sc1) { with(sc0) { return (expression) } }
|
||||
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
|
||||
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
|
||||
return new Function("$context", "$element", functionBody);
|
||||
},
|
||||
|
||||
// The following function is only used internally by this default provider.
|
||||
// It's not part of the interface definition for a general binding provider.
|
||||
'getBindingsString': (node, bindingContext) => {
|
||||
getBindingsString = node => {
|
||||
switch (node.nodeType) {
|
||||
case 1: return node.getAttribute(defaultBindingAttributeName); // Element
|
||||
case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node
|
||||
|
|
@ -38,31 +30,32 @@
|
|||
|
||||
// The following function is only used internally by this default provider.
|
||||
// It's not part of the interface definition for a general binding provider.
|
||||
'parseBindingsString': function(bindingsString, bindingContext, node, options) {
|
||||
parseBindingsString = (bindingsString, bindingContext, node, options) => {
|
||||
try {
|
||||
var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, this.bindingCache, options);
|
||||
var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, bindingCache, options);
|
||||
return bindingFunction(bindingContext, node);
|
||||
} catch (ex) {
|
||||
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString + "\nMessage: " + ex.message;
|
||||
throw ex;
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingProvider = new class
|
||||
{
|
||||
nodeHasBindings(node) {
|
||||
switch (node.nodeType) {
|
||||
case 1: // Element
|
||||
return node.getAttribute(defaultBindingAttributeName) != null;
|
||||
case 8: // Comment node
|
||||
return ko.virtualElements.hasBindingValue(node);
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ko.bindingProvider['instance'] = new ko.bindingProvider();
|
||||
getBindingAccessors(node, bindingContext) {
|
||||
var bindingsString = getBindingsString(node, bindingContext);
|
||||
return bindingsString ? parseBindingsString(bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
|
||||
}
|
||||
};
|
||||
|
||||
function createBindingsStringEvaluatorViaCache(bindingsString, cache, options) {
|
||||
var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
|
||||
return cache[cacheKey]
|
||||
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
|
||||
}
|
||||
|
||||
function createBindingsStringEvaluator(bindingsString, options) {
|
||||
// Build the source for a function that evaluates "expression"
|
||||
// For each scope variable, add an extra level of "with" nesting
|
||||
// Example result: with(sc1) { with(sc0) { return (expression) } }
|
||||
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
|
||||
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
|
||||
return new Function("$context", "$element", functionBody);
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue