mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 09:02:45 +08:00
Bugfix: KnockoutJS failed to output text '0'
This commit is contained in:
parent
905315b164
commit
a0f7114a39
3 changed files with 4 additions and 4 deletions
|
@ -119,7 +119,7 @@ ko.utils = {
|
|||
unwrapObservable: value => ko.isObservable(value) ? value() : value,
|
||||
|
||||
setTextContent: (element, textContent) =>
|
||||
element.textContent = ko.utils.unwrapObservable(textContent) || ""
|
||||
element.textContent = ko.utils.unwrapObservable(textContent)
|
||||
};
|
||||
|
||||
ko.exportSymbol('utils', ko.utils);
|
||||
|
|
|
@ -10,8 +10,8 @@ f;)f=c.m.nextSibling(d),Y(a,d);c.l.notify(b,c.l.D)}function Y(a,b){var d=a;if(1=
|
|||
q.length&&m(q,c.dataFor(q[0]))}});c.l.fa in l&&(g=c.l.cb(a,d),c.l.subscribe(a,c.l.fa,()=>{var m=l[c.l.fa]();m&&c.m.firstChild(a)&&m(a)}));ka(l).forEach(m=>{var q=m.xb.init,r=m.xb.update,t=m.key;if(8===a.nodeType&&!c.m.ba[t])throw Error("The binding '"+t+"' cannot be used with virtual elements");try{"function"==typeof q&&c.u.J(()=>{var u=q(a,n(t),p,g.$data,g);if(u&&u.controlsDescendantBindings){if(void 0!==k)throw Error("Multiple bindings ("+k+" and "+t+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
|
||||
k=t}}),"function"==typeof r&&c.o(()=>r(a,n(t),p,g.$data,g),{s:a})}catch(u){throw u.message='Unable to process binding "'+t+": "+l[t]+'"\nMessage: '+u.message,u;}})}f=void 0===k;return{shouldBindDescendants:f,bindingContextForDescendants:f&&g}}function P(a,b){return a&&a instanceof c.da?a:new c.da(a,void 0,void 0,b)}var J=V.document,Q={},c="undefined"!==typeof Q?Q:{};c.S=(a,b)=>{a=a.split(".");for(var d=c,f=0,h=a.length-1;f<h;f++)d=d[a[f]];d[a[h]]=b};c.version="3.5.1-sm";c.g={extend:(a,b)=>b?Object.assign(a,
|
||||
b):a,M:(a,b)=>a&&Object.entries(a).forEach(d=>b(d[0],d[1])),Va:a=>[...a.childNodes].forEach(b=>c.removeNode(b)),Ab:a=>{a=[...a];var b=(a[0]?.ownerDocument||J).createElement("div");a.forEach(d=>b.append(c.ea(d)));return b},ua:(a,b)=>Array.prototype.map.call(a,b?d=>c.ea(d.cloneNode(!0)):d=>d.cloneNode(!0)),qa:(a,b)=>{c.g.Va(a);b&&a.append(...b)},xa:(a,b)=>{if(a.length){for(b=8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==b;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==b;)--a.length;
|
||||
if(1<a.length){b=a[0];var d=a[a.length-1];for(a.length=0;b!==d;)a.push(b),b=b.nextSibling;a.push(d)}}return a},Gb:a=>null==a?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),Ua:a=>a.ownerDocument.documentElement.contains(1!==a.nodeType?a.parentNode:a),Ib:(a,b)=>{if(!a?.nodeType)throw Error("element must be a DOM node when calling triggerEvent");a.dispatchEvent(new Event(b))},i:a=>c.T(a)?a():a,bb:(a,b)=>a.textContent=c.g.i(b)||""};c.S("utils",c.g);c.S("unwrap",c.g.i);(()=>{let a=
|
||||
0,b="__ko__"+Date.now(),d=new WeakMap;c.g.j={get:(f,h)=>(d.get(f)||{})[h],set:(f,h,l)=>{d.has(f)?d.get(f)[h]=l:d.set(f,{[h]:l});return l},Wa(f,h,l){return this.get(f,h)||this.set(f,h,l)},clear:f=>d.delete(f),Y:()=>a++ +b}})();c.g.O=(()=>{var a=c.g.j.Y(),b={1:1,8:1,9:1},d={1:1,9:1};const f=(e,g)=>{var k=c.g.j.get(e,a);g&&!k&&(k=new Set,c.g.j.set(e,a,k));return k},h=e=>{var g=f(e);g&&(new Set(g)).forEach(k=>k(e));c.g.j.clear(e);d[e.nodeType]&&l(e.childNodes,!0)},l=(e,g)=>{for(var k=[],n,p=0;p<e.length;p++)if(!g||
|
||||
if(1<a.length){b=a[0];var d=a[a.length-1];for(a.length=0;b!==d;)a.push(b),b=b.nextSibling;a.push(d)}}return a},Gb:a=>null==a?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),Ua:a=>a.ownerDocument.documentElement.contains(1!==a.nodeType?a.parentNode:a),Ib:(a,b)=>{if(!a?.nodeType)throw Error("element must be a DOM node when calling triggerEvent");a.dispatchEvent(new Event(b))},i:a=>c.T(a)?a():a,bb:(a,b)=>a.textContent=c.g.i(b)};c.S("utils",c.g);c.S("unwrap",c.g.i);(()=>{let a=0,
|
||||
b="__ko__"+Date.now(),d=new WeakMap;c.g.j={get:(f,h)=>(d.get(f)||{})[h],set:(f,h,l)=>{d.has(f)?d.get(f)[h]=l:d.set(f,{[h]:l});return l},Wa(f,h,l){return this.get(f,h)||this.set(f,h,l)},clear:f=>d.delete(f),Y:()=>a++ +b}})();c.g.O=(()=>{var a=c.g.j.Y(),b={1:1,8:1,9:1},d={1:1,9:1};const f=(e,g)=>{var k=c.g.j.get(e,a);g&&!k&&(k=new Set,c.g.j.set(e,a,k));return k},h=e=>{var g=f(e);g&&(new Set(g)).forEach(k=>k(e));c.g.j.clear(e);d[e.nodeType]&&l(e.childNodes,!0)},l=(e,g)=>{for(var k=[],n,p=0;p<e.length;p++)if(!g||
|
||||
8===e[p].nodeType)if(h(k[k.length]=n=e[p]),e[p]!==n)for(;p--&&!k.includes(e[p]););};return{addDisposeCallback:(e,g)=>{if("function"!=typeof g)throw Error("Callback must be a function");f(e,1).add(g)},ab:(e,g)=>{var k=f(e);k&&(k.delete(g),k.size||c.g.j.set(e,a,null))},ea:e=>{c.u.J(()=>{b[e.nodeType]&&(h(e),d[e.nodeType]&&l(e.getElementsByTagName("*")))});return e},removeNode:e=>{c.ea(e);e.parentNode&&e.parentNode.removeChild(e)}}})();c.ea=c.g.O.ea;c.removeNode=c.g.O.removeNode;c.S("utils.domNodeDisposal",
|
||||
c.g.O);c.extenders={debounce:(a,b)=>a.Ea(d=>ha(d,b)),rateLimit:(a,b)=>a.Ea(d=>fa(d,b)),notify:(a,b)=>{a.ma="always"==b?null:O}};var ea={undefined:1,"boolean":1,number:1,string:1};class la{constructor(a,b,d){this.W=a;this.gb=b;this.za=d;this.Ka=!1;this.I=this.ga=null}dispose(){this.Ka||(this.I&&c.g.O.ab(this.ga,this.I),this.Ka=!0,this.za(),this.W=this.gb=this.za=this.ga=this.I=null)}s(a){this.ga=a;c.g.O.addDisposeCallback(a,this.I=this.dispose.bind(this))}}c.U=function(){Object.setPrototypeOf(this,
|
||||
R);R.init(this)};var R={init:a=>{a.V=new Map;a.V.set("change",new Set);a.lb=1},subscribe:function(a,b,d){var f=this;d=d||"change";var h=new la(f,b?a.bind(b):a,()=>{f.V.get(d).delete(h);f.La?.(d)});f.Na?.(d);f.V.has(d)||f.V.set(d,new Set);f.V.get(d).add(h);return h},B(a,b){b=b||"change";"change"===b&&this.Ha();if(this.oa(b)){b="change"===b&&this.Jb||new Set(this.V.get(b));try{c.u.pb(),b.forEach(d=>{d.Ka||d.gb(a)})}finally{c.u.end()}}},ya(){return this.lb},Vb(a){return this.ya()!==a},Ha(){++this.lb},
|
||||
|
|
2
vendors/knockout/src/utils.js
vendored
2
vendors/knockout/src/utils.js
vendored
|
@ -92,7 +92,7 @@ ko.utils = {
|
|||
unwrapObservable: value => ko.isObservable(value) ? value() : value,
|
||||
|
||||
setTextContent: (element, textContent) =>
|
||||
element.textContent = ko.utils.unwrapObservable(textContent) || ""
|
||||
element.textContent = ko.utils.unwrapObservable(textContent)
|
||||
};
|
||||
|
||||
ko.exportSymbol('utils', ko.utils);
|
||||
|
|
Loading…
Reference in a new issue