From b98762dd686ea906526c2d03d9e68ad756905215 Mon Sep 17 00:00:00 2001 From: djmaze Date: Wed, 8 Dec 2021 11:35:41 +0100 Subject: [PATCH] Replace deprecated String.substr with String.slice --- dev/Common/Html.js | 4 +-- dev/Common/Links.js | 4 +-- dev/Common/Translator.js | 10 +++--- dev/Common/UtilsUser.js | 12 +++---- dev/Component/EmailAddresses.js | 2 +- dev/Knoin/AbstractModel.js | 2 +- dev/Model/Attachment.js | 2 +- dev/Remote/AbstractFetch.js | 4 +-- dev/View/Popup/Compose.js | 6 ++-- dev/View/Popup/ComposeOpenPgp.js | 12 +++---- dev/View/Popup/FolderCreate.js | 4 +-- dev/boot.js | 2 +- .../build/output/knockout-latest.debug.js | 6 ++-- .../knockout/build/output/knockout-latest.js | 32 +++++++++---------- .../src/binding/defaultBindings/attr.js | 2 +- .../src/binding/defaultBindings/value.js | 2 +- .../src/binding/expressionRewriting.js | 2 +- 17 files changed, 54 insertions(+), 54 deletions(-) diff --git a/dev/Common/Html.js b/dev/Common/Html.js index 011012dc2..31c8948ef 100644 --- a/dev/Common/Html.js +++ b/dev/Common/Html.js @@ -140,8 +140,8 @@ export class HtmlEditor { } setHtmlOrPlain(text) { - if (':HTML:' === text.substr(0, 6)) { - this.setHtml(text.substr(6)); + if (':HTML:' === text.slice(0, 6)) { + this.setHtml(text.slice(6)); } else { this.setPlain(text); } diff --git a/dev/Common/Links.js b/dev/Common/Links.js index eda066754..0cf3b7cca 100644 --- a/dev/Common/Links.js +++ b/dev/Common/Links.js @@ -81,8 +81,8 @@ export const */ themePreviewLink = theme => { let prefix = VERSION_PREFIX; - if ('@custom' === theme.substr(-7)) { - theme = theme.substr(0, theme.length - 7).trim(); + if ('@custom' === theme.slice(-7)) { + theme = theme.slice(0, theme.length - 7).trim(); prefix = Settings.app('webPath') || ''; } diff --git a/dev/Common/Translator.js b/dev/Common/Translator.js index 6b5eeb2ff..45a029b3e 100644 --- a/dev/Common/Translator.js +++ b/dev/Common/Translator.js @@ -10,16 +10,16 @@ const i18nToNode = element => { const key = element.dataset.i18n; if (key) { - if ('[' === key.substr(0, 1)) { - switch (key.substr(0, 6)) { + if ('[' === key.slice(0, 1)) { + switch (key.slice(0, 6)) { case '[html]': - element.innerHTML = i18n(key.substr(6)); + element.innerHTML = i18n(key.slice(6)); break; case '[place': - element.placeholder = i18n(key.substr(13)); + element.placeholder = i18n(key.slice(13)); break; case '[title': - element.title = i18n(key.substr(7)); + element.title = i18n(key.slice(7)); break; // no default } diff --git a/dev/Common/UtilsUser.js b/dev/Common/UtilsUser.js index 0fe05ac5e..7e563a417 100644 --- a/dev/Common/UtilsUser.js +++ b/dev/Common/UtilsUser.js @@ -104,7 +104,7 @@ htmlToPlain = (html) => { iP3 = text.indexOf('__bq__end__', iP1 + 5); if ((-1 === iP2 || iP3 < iP2) && iP1 < iP3) { - text = text.substr(0, iP1) + convertBlockquote(text.substring(iP1 + 13, iP3)) + text.substr(iP3 + 11); + text = text.slice(0, iP1) + convertBlockquote(text.slice(iP1 + 13, iP3)) + text.slice(iP3 + 11); pos = 0; } else if (-1 < iP2 && iP2 < iP3) { pos = iP2 - 1; @@ -135,12 +135,12 @@ plainToHtml = (plain) => { bDo = false; aNextText = []; aText.forEach(sLine => { - bStart = '>' === sLine.substr(0, 1); + bStart = '>' === sLine.slice(0, 1); if (bStart && !bIn) { bDo = true; bIn = true; aNextText.push('~~~blockquote~~~'); - aNextText.push(sLine.substr(1)); + aNextText.push(sLine.slice(1)); } else if (!bStart && bIn) { if (sLine) { bIn = false; @@ -150,7 +150,7 @@ plainToHtml = (plain) => { aNextText.push(sLine); } } else if (bStart && bIn) { - aNextText.push(sLine.substr(1)); + aNextText.push(sLine.slice(1)); } else { aNextText.push(sLine); } @@ -344,10 +344,10 @@ mailToHelper = (mailToUrl) => { 'mailto:' === mailToUrl .toString() - .substr(0, 7) + .slice(0, 7) .toLowerCase() ) { - mailToUrl = mailToUrl.toString().substr(7); + mailToUrl = mailToUrl.toString().slice(7); let to = [], params = {}; diff --git a/dev/Component/EmailAddresses.js b/dev/Component/EmailAddresses.js index e9d6ee80a..87eee5274 100644 --- a/dev/Component/EmailAddresses.js +++ b/dev/Component/EmailAddresses.js @@ -142,7 +142,7 @@ export class EmailAddressesComponent { values = []; const v = val.trim(), - hook = (v && [',', ';', '\n'].includes(v.substr(-1))) + hook = (v && [',', ';', '\n'].includes(v.slice(-1))) ? EmailModel.splitEmailLine(val) : null; diff --git a/dev/Knoin/AbstractModel.js b/dev/Knoin/AbstractModel.js index 6bc95edf6..d36aa2cc2 100644 --- a/dev/Knoin/AbstractModel.js +++ b/dev/Knoin/AbstractModel.js @@ -91,7 +91,7 @@ export class AbstractModel { } forEachObjectEntry(json, (key, value) => { if ('@' !== key[0]) try { - key = key[0].toLowerCase() + key.substr(1); + key = key[0].toLowerCase() + key.slice(1); switch (typeof this[key]) { case 'function': diff --git a/dev/Model/Attachment.js b/dev/Model/Attachment.js index 4c2573857..6988e76c5 100644 --- a/dev/Model/Attachment.js +++ b/dev/Model/Attachment.js @@ -175,7 +175,7 @@ export class AttachmentModel extends AbstractModel { const localEvent = event.originalEvent || event; if (attachment && localEvent && localEvent.dataTransfer && localEvent.dataTransfer.setData) { let link = this.linkDownload(); - if ('http' !== link.substr(0, 4)) { + if ('http' !== link.slice(0, 4)) { link = location.protocol + '//' + location.host + location.pathname + link; } localEvent.dataTransfer.setData('DownloadURL', this.mimeType + ':' + this.fileName + ':' + link); diff --git a/dev/Remote/AbstractFetch.js b/dev/Remote/AbstractFetch.js index 180d221ed..85a4c5847 100644 --- a/dev/Remote/AbstractFetch.js +++ b/dev/Remote/AbstractFetch.js @@ -104,8 +104,8 @@ export class AbstractFetchRemote reader.read().then(processText); return; } - fCallback(buffer.substring(0, result.index)); - buffer = buffer.substring(result.index + 1); + fCallback(buffer.slice(0, result.index)); + buffer = buffer.slice(result.index + 1); re.lastIndex = 0; } if (buffer.length) { diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 0baf270ea..c4226a991 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -681,10 +681,10 @@ class ComposePopupView extends AbstractViewPopup { if (identity) { this.editor(editor => { let signature = identity.signature(), - isHtml = signature && ':HTML:' === signature.substr(0, 6); + isHtml = signature && ':HTML:' === signature.slice(0, 6); editor.setSignature( - this.convertSignature(isHtml ? signature.substr(6) : signature), + this.convertSignature(isHtml ? signature.slice(6) : signature), isHtml, !!identity.signatureInsertBefore()); }); } @@ -1293,7 +1293,7 @@ class ComposePopupView extends AbstractViewPopup { addMessageAsAttachment(message) { if (message) { let temp = message.subject(); - temp = '.eml' === temp.substr(-4).toLowerCase() ? temp : temp + '.eml'; + temp = '.eml' === temp.slice(-4).toLowerCase() ? temp : temp + '.eml'; const attachment = new ComposeAttachmentModel(message.requestHash, temp, message.size()); diff --git a/dev/View/Popup/ComposeOpenPgp.js b/dev/View/Popup/ComposeOpenPgp.js index 4b655df02..877fd22b8 100644 --- a/dev/View/Popup/ComposeOpenPgp.js +++ b/dev/View/Popup/ComposeOpenPgp.js @@ -51,7 +51,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup { } return oKey.users.map(user => ({ id: oKey.guid, - name: '(' + oKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user, + name: '(' + oKey.id.slice(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user, key: oKey })); }); @@ -66,7 +66,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup { } return oKey.users.map(user => ({ id: oKey.guid, - name: '(' + oKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user, + name: '(' + oKey.id.slice(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user, key: oKey })); }); @@ -241,7 +241,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup { empty: !option.key, selected: ko.observable(!!option.key), users: option.key.users, - hash: option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(), + hash: option.key.id.slice(KEY_NAME_SUBSTR).toUpperCase(), key: option.key }); } @@ -257,7 +257,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup { selected: ko.observable(!!option.key), removable: ko.observable(!this.sign() || !this.signKey() || this.signKey().key.id !== option.key.id), users: option.key.users, - hash: option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(), + hash: option.key.id.slice(KEY_NAME_SUBSTR).toUpperCase(), key: option.key }); } @@ -345,7 +345,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup { if (keys && keys[0]) { this.signKey({ users: keys[0].users || [emailLine], - hash: keys[0].id.substr(KEY_NAME_SUBSTR).toUpperCase(), + hash: keys[0].id.slice(KEY_NAME_SUBSTR).toUpperCase(), key: keys[0] }); } @@ -367,7 +367,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup { !this.sign() || !this.signKey() || this.signKey().key.id !== publicKey.id ), users: publicKey ? publicKey.users || [recEmail] : [recEmail], - hash: publicKey ? publicKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() : '', + hash: publicKey ? publicKey.id.slice(KEY_NAME_SUBSTR).toUpperCase() : '', key: publicKey })) : []; diff --git a/dev/View/Popup/FolderCreate.js b/dev/View/Popup/FolderCreate.js index caf38ef09..1f3213d62 100644 --- a/dev/View/Popup/FolderCreate.js +++ b/dev/View/Popup/FolderCreate.js @@ -34,7 +34,7 @@ class FolderCreatePopupView extends AbstractViewPopup { oItem => oItem ? (oItem.isSystemFolder() ? oItem.name() + ' ' + oItem.manageFolderSystemName() : oItem.name()) : '', FolderUserStore.namespace - ? item => FolderUserStore.namespace !== item.fullName.substr(0, FolderUserStore.namespace.length) + ? item => FolderUserStore.namespace !== item.fullName.slice(0, FolderUserStore.namespace.length) : null, true ) @@ -50,7 +50,7 @@ class FolderCreatePopupView extends AbstractViewPopup { createFolderCommand() { let parentFolderName = this.selectedParentValue(); if (!parentFolderName && 1 < FolderUserStore.namespace.length) { - parentFolderName = FolderUserStore.namespace.substr(0, FolderUserStore.namespace.length - 1); + parentFolderName = FolderUserStore.namespace.slice(0, FolderUserStore.namespace.length - 1); } Remote.abort('Folders').post('FolderCreate', FolderUserStore.foldersCreating, { diff --git a/dev/boot.js b/dev/boot.js index 8b7ff29b7..1925ed8a2 100644 --- a/dev/boot.js +++ b/dev/boot.js @@ -99,7 +99,7 @@ try { css.href = css.dataset.href; -loadScript(`./?/${admin ? 'Admin' : ''}AppData/0/${Math.random().toString().substr(2)}/`) +loadScript(`./?/${admin ? 'Admin' : ''}AppData/0/${Math.random().toString().slice(2)}/`) .then(() => 0); })(this); diff --git a/vendors/knockout/build/output/knockout-latest.debug.js b/vendors/knockout/build/output/knockout-latest.debug.js index 03879b0c6..9d151130f 100644 --- a/vendors/knockout/build/output/knockout-latest.debug.js +++ b/vendors/knockout/build/output/knockout-latest.debug.js @@ -1536,7 +1536,7 @@ ko.expressionRewriting = (() => { var match = toks[i-1].match(divisionLookBehind); if (match && !keywordRegexLookBehind[match[0]]) { // The slash is actually a division punctuator; re-parse the remainder of the string (not including the slash) - str = str.substr(str.indexOf(tok) + 1); + str = str.slice(str.indexOf(tok) + 1); toks = str.match(bindingToken); i = -1; // Continue with just the slash @@ -2528,7 +2528,7 @@ ko.bindingHandlers['attr'] = { // Find the namespace of this attribute, if any. var prefixLen = attrName.indexOf(':'); - var namespace = "lookupNamespaceURI" in element && prefixLen > 0 && element.lookupNamespaceURI(attrName.substr(0, prefixLen)); + var namespace = "lookupNamespaceURI" in element && prefixLen > 0 && element.lookupNamespaceURI(attrName.slice(0, prefixLen)); // To cover cases like "attr: { checked:someProp }", we want to remove the attribute entirely // when someProp is a "no value"-like value (strictly null, false, or undefined) @@ -3123,7 +3123,7 @@ ko.bindingHandlers['value'] = { elementValueBeforeEvent = ko.selectExtensions.readValue(element); setTimeout(valueUpdateHandler, 0); }; - eventName = eventName.substring(5); + eventName = eventName.slice(5); } registerEventHandler(eventName, handler); }); diff --git a/vendors/knockout/build/output/knockout-latest.js b/vendors/knockout/build/output/knockout-latest.js index 02cfa0601..246a724e3 100644 --- a/vendors/knockout/build/output/knockout-latest.js +++ b/vendors/knockout/build/output/knockout-latest.js @@ -31,7 +31,7 @@ a.G=0;a.W=!0;a.X=!1;a.T=!1;a.u=!1;a.i=void 0;a.oa=void 0;a.Jb=void 0}},Z={ma:fun "asleep"))},Aa:function(){var a=this[A];a.u&&(a.X||this.ra())&&this.O();return b.P.fn.Aa.call(this)}},aa={ma:function(a){"change"!=a&&"beforeChange"!=a||this.F()}};Object.setPrototypeOf(M,b.P.fn);M[b.Y.B]=b.j;b.o("computed",b.j);b.o("computed.fn",M);b.ea(M,"dispose",M.m);b.mc=a=>{if("function"===typeof a)return b.j(a,{pure:!0});a={...a,pure:!0};return b.j(a)};(()=>{b.v={L:a=>{switch(a.nodeName){case "OPTION":return!0===a.__ko__hasDomDataOptionValue__?b.a.c.get(a,b.b.options.ab):a.value;case "SELECT":return 0<= a.selectedIndex?b.v.L(a.options[a.selectedIndex]):void 0;default:return a.value}},Ka:(a,c,d)=>{switch(a.nodeName){case "OPTION":"string"===typeof c?(b.a.c.set(a,b.b.options.ab,void 0),delete a.__ko__hasDomDataOptionValue__,a.value=c):(b.a.c.set(a,b.b.options.ab,c),a.__ko__hasDomDataOptionValue__=!0,a.value="number"===typeof c?c:"");break;case "SELECT":for(var g=-1,k=""===c||null==c,t=0,e=a.options.length,f;t{function a(f){f=b.a.Nb(f);123===f.charCodeAt(0)&&(f=f.slice(1,-1));f+="\n,";var h=[],r=f.match(g),p=[],q=0;if(1=q){h.push(u&&p.length?{key:u,value:p.join("")}:{unknown:u||p.join("")});var u=q=0;p=[];continue}}else if(58===m){if(!q&&!u&&1===p.length){u=p.pop();continue}}else if(47===m&&1 r(m.key||m.unknown,m.value));q.length&&r("_ko_property_writers","{"+q.join(",")+" }");return p.join(",")},ic:(f,h)=>-1r.key==h),jb:(f,h,r,p,q)=>{if(f&&b.N(f))!b.hc(f)||q&&f.F()===p||f(p);else if((f=h.get("_ko_property_writers"))&&f[r])f[r](p)}}})();(()=>{function a(e){return 8==e.nodeType&&g.test(e.nodeValue)}function c(e){return 8==e.nodeType&&k.test(e.nodeValue)}function d(e,f){for(var h=e,r=1,p=[];h=h.nextSibling;){if(c(h)&&(b.a.c.set(h,t,!0),!--r))return p;p.push(h);a(h)&&++r}if(!f)throw Error("Cannot find closing comment tag to match: "+ e.nodeValue);return null}var g=/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=/^\s*\/ko\s*$/,t="__ko_matchedEndComment__";b.h={Z:{},childNodes:e=>a(e)?d(e):e.childNodes,pa:e=>{a(e)?(e=d(e))&&[...e].forEach(f=>b.removeNode(f)):b.a.Va(e)},sa:(e,f)=>{a(e)?(b.h.pa(e),e.after(...f)):b.a.sa(e,f)},prepend:(e,f)=>{a(e)?e.nextSibling.before(f):e.prepend(f)},Eb:(e,f,h)=>{h?h.after(f):b.h.prepend(e,f)},firstChild:e=>{if(a(e))return e=e.nextSibling,!e||c(e)?null:e;let f=e.firstChild;if(f&&c(f))throw Error("Found invalid end comment, as the first child of "+ @@ -49,7 +49,7 @@ d(t(l,m),n)};b.zb=l=>(l=l&&[1,8].includes(l.nodeType)&&b.pc(l))?l.$data:void 0;b ("function"!==typeof p[e]&&c(f,"Unknown viewModel value: "+p),r[e]=p[e]);r.template&&r[e]?h(r):h(null)}function c(f,h){throw Error(`Component '${f}': ${h}`);}function d(f,h){var r=!1;a(f,p=>{(r=null!=p)&&h(p)});r||h(null)}var g=Object.create(null),k=Object.create(null);b.Pa={get:(f,h)=>{var r=k[f];if(r)b.Pb.Lb(()=>h(r.definition));else{var p=g[f];if(p)p.subscribe(h);else{p=g[f]=new b.P;p.subscribe(h);d(f,l=>{k[f]={definition:l};delete g[f];q?p.notifySubscribers(l):b.Pb.Lb(()=>p.notifySubscribers(l))}); var q=!0}}},rc:f=>delete k[f],register:(f,h)=>{if(!h)throw Error("Invalid configuration for "+f);if(t[f])throw Error("Component "+f+" is already registered");t[f]=h}};var t=Object.create(null),e="createViewModel";b.o("components",b.Pa);b.o("components.register",b.Pa.register)})();(()=>{var a=0;b.b.component={init:(c,d,g,k,t)=>{var e,f,h,r=()=>{var q=e&&e.dispose;"function"===typeof q&&q.call(e);h&&h.m();f=e=h=null},p=[...b.h.childNodes(c)];b.h.pa(c);b.a.H.la(c,r);b.j(()=>{var q=b.a.f(d());if("string"!== typeof q){var l=b.a.f(q.params);q=b.a.f(q.name)}if(!q)throw Error("No component name specified");var n=b.g.fb(c,t),m=f=++a;b.Pa.get(q,u=>{if(f===m){r();if(!u)throw Error("Unknown component '"+q+"'");var w=u.template;if(!w)throw Error("Component '"+q+"' has no template");b.h.sa(c,b.a.wa(w));e=u.createViewModel(l,{element:c,templateNodes:p});b.tb(n.createChildContext(e,{extend:v=>{v.$component=e;v.$componentTemplateNodes=p}}),c)}})},{i:c});return{controlsDescendantBindings:!0}}};b.h.Z.component=!0})(); -b.b.attr={update:(a,c)=>{c=b.a.f(c())||{};b.a.K(c,function(d,g){g=b.a.f(g);var k=d.indexOf(":");k="lookupNamespaceURI"in a&&0{c&&c.split(/\s+/).forEach(g=>a.classList.toggle(g,d))};b.b.css={update:(a,c)=>{c=b.a.f(c());null!==c&&"object"==typeof c?b.a.K(c,(d,g)=>{g=b.a.f(g);Q(a, +b.b.attr={update:(a,c)=>{c=b.a.f(c())||{};b.a.K(c,function(d,g){g=b.a.f(g);var k=d.indexOf(":");k="lookupNamespaceURI"in a&&0{c&&c.split(/\s+/).forEach(g=>a.classList.toggle(g,d))};b.b.css={update:(a,c)=>{c=b.a.f(c());null!==c&&"object"==typeof c?b.a.K(c,(d,g)=>{g=b.a.f(g);Q(a, d,!!g)}):(c=b.a.Nb(c),Q(a,a.__ko__cssValue,!1),a.__ko__cssValue=c,Q(a,c,!0))}};b.b.enable={update:(a,c)=>{(c=b.a.f(c()))&&a.disabled?a.removeAttribute("disabled"):c||a.disabled||(a.disabled=!0)}};b.b.disable={update:(a,c)=>b.b.enable.update(a,()=>!b.a.f(c()))};b.b.event={init:(a,c,d,g,k)=>{d=c()||{};b.a.K(d,t=>{"string"==typeof t&&a.addEventListener(t,function(e){var f=c()[t];if(f)try{g=k.$data;var h=f.apply(g,[g,...arguments])}finally{!0!==h&&e.preventDefault()}})})}};b.b.foreach={Gb:a=>()=>{var c= a(),d=b.N(c)?c.F():c;if(!d||"number"==typeof d.length)return{foreach:c};b.a.f(c);return{foreach:d.data,as:d.as,beforeRemove:d.beforeRemove}},init:(a,c)=>b.b.template.init(a,b.b.foreach.Gb(c)),update:(a,c,d,g,k)=>b.b.template.update(a,b.b.foreach.Gb(c),d,g,k)};b.D.Na.foreach=!1;b.h.Z.foreach=!0;b.b.hasfocus={init:(a,c,d)=>{var g=t=>{a.__ko_hasfocusUpdating=!0;t=a.ownerDocument.activeElement===a;var e=c();b.D.jb(e,d,"hasfocus",t,!0);a.__ko_hasfocusLastValue=t;a.__ko_hasfocusUpdating=!1},k=g.bind(null, !0);g=g.bind(null,!1);a.addEventListener("focus",k);a.addEventListener("focusin",k);a.addEventListener("blur",g);a.addEventListener("focusout",g);a.__ko_hasfocusLastValue=!1},update:(a,c)=>{c=!!b.a.f(c());a.__ko_hasfocusUpdating||a.__ko_hasfocusLastValue===c||(c?a.focus():a.blur())}};b.D.hb.add("hasfocus");b.b.html={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>{b.a.Va(a);c=b.a.f(c());if(null!=c){const d=L.createElement("template");d.innerHTML="string"!=typeof c?c.toString():c;a.appendChild(d.content)}}}; @@ -60,17 +60,17 @@ var e=a.multiple,f=0!=a.length&&e?a.scrollTop:null,h=b.a.f(c()),r=d.get("valueAl 0<=a.selectedIndex;n&&b.l.M(b.a.Qb,null,[a,"change"])}(r||b.l.Za())&&b.g.notify(a,b.g.A);f&&20{c=b.a.f(c()||{});b.a.K(c,(d,g)=>{g=b.a.f(g);if(null==g||!1===g)g="";if(/^--/.test(d))a.style.setProperty(d,g);else{d=d.replace(/-(\w)/g,(t,e)=>e.toUpperCase());var k=a.style[d];a.style[d]=g;g===k||a.style[d]!=k||isNaN(g)||(a.style[d]=g+"px")}})}};b.b.submit={init:(a,c,d,g,k)=>{if("function"!=typeof c())throw Error("The value for a submit binding must be a function"); a.addEventListener("submit",t=>{var e=c();try{var f=e.call(k.$data,a)}finally{!0!==f&&(t.preventDefault?t.preventDefault():t.returnValue=!1)}})}};b.b.text={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>{8===a.nodeType&&(a.text||a.after(a.text=L.createTextNode("")),a=a.text);b.a.eb(a,c())}};b.h.Z.text=!0;b.b.textInput={init:(a,c,d)=>{var g=a.value,k,t,e=()=>{clearTimeout(k);t=k=void 0;var h=a.value;g!==h&&(g=h,b.D.jb(c(),d,"textInput",h))},f=()=>{var h=b.a.f(c());null==h&&(h="");void 0!== t&&h===t?setTimeout(f,4):a.value!==h&&(a.value=h,g=a.value)};a.addEventListener("input",e);a.addEventListener("change",e);a.addEventListener("blur",e);b.j(f,{i:a})}};b.D.hb.add("textInput");b.b.textinput={preprocess:(a,c,d)=>d("textInput",a)};b.b.value={init:(a,c,d)=>{var g=a.matches("SELECT"),k=a.matches("INPUT");if(!k||"checkbox"!=a.type&&"radio"!=a.type){var t=new Set,e=d.get("valueUpdate"),f=null;e&&("string"==typeof e?t.add(e):e.forEach(q=>t.add(q)),t.delete("change"));var h=()=>{f=null;var q= -c(),l=b.v.L(a);b.D.jb(q,d,"value",l)};t.forEach(q=>{var l=h;(q||"").startsWith("after")&&(l=()=>{f=b.v.L(a);setTimeout(h,0)},q=q.substring(5));a.addEventListener(q,l)});var r=k&&"file"==a.type?()=>{var q=b.a.f(c());null==q||""===q?a.value="":b.l.M(h)}:()=>{var q=b.a.f(c()),l=b.v.L(a);if(null!==f&&q===f)setTimeout(r,0);else if(q!==l||void 0===l)g?(l=d.get("valueAllowUnset"),b.v.Ka(a,q,l),l||q===b.v.L(a)||b.l.M(h)):b.v.Ka(a,q)};if(g){var p;b.g.subscribe(a,b.g.A,()=>{p?d.get("valueAllowUnset")?r():h(): -(a.addEventListener("change",h),p=b.j(r,{i:a}))},null,{notifyImmediately:!0})}else a.addEventListener("change",h),b.j(r,{i:a})}else b.rb(a,{checkedValue:c})},update:()=>{}};b.D.hb.add("value");b.b.visible={update:(a,c)=>{c=b.a.f(c());var d="none"!=a.style.display;c&&!d?a.style.display="":d&&!c&&(a.style.display="none")}};b.b.hidden={update:(a,c)=>a.hidden=!!b.a.f(c())};(function(a){b.b[a]={init:function(c,d,g,k,t){return b.b.event.init.call(this,c,()=>({[a]:d()}),g,k,t)}}})("click");(()=>{let a=b.a.c.U(); -class c{constructor(g){this.Sa=g}Ga(...g){let k=this.Sa;if(!g.length)return b.a.c.get(k,a)||(11===this.B?k.content:1===this.B?k:void 0);b.a.c.set(k,a,g[0])}}class d extends c{constructor(g){super(g);g&&(this.B=g.matches("TEMPLATE")&&g.content?g.content.nodeType:1)}}b.Ha={Sa:d,Ma:c}})();(()=>{function a(e,f){if(e.length){var h=e[0],r=h.parentNode;g(h,e[e.length-1],p=>{1!==p.nodeType&&8!==p.nodeType||b.sb(f,p)});b.a.ya(e,r)}}function c(e,f,h,r){var p=(e&&(e.nodeType?e:0{var r;for(f=b.h.nextSibling(f);e&&(r=e)!==f;)e=b.h.nextSibling(r),h(r,e)};b.nc=function(e,f,h,r){h=h||{};var p=p||"replaceChildren";if(r){var q=r.nodeType?r:0{var l=f&&f instanceof b.aa?f:new b.aa(f,null,null,null,{exportDependencies:!0}),n=d(e,l.$data,l);c(r,p,n,l,h)},{oa:()=> -!q||!b.a.Ua(q),i:q})}console.log("no targetNodeOrNodeArray")};b.oc=(e,f,h,r,p)=>{function q(v,y){b.l.M(b.a.Mb,null,[r,v,m,h,u,y]);b.g.notify(r,b.g.A)}var l,n=h.as,m=(v,y)=>{l=p.createChildContext(v,{as:n,extend:x=>{x.$index=y;n&&(x[n+"Index"]=y)}});v=d(e,v,l);return c(r,"ignoreTargetNode",v,l,h)},u=(v,y)=>{a(y,l);l=null};if(!h.beforeRemove&&b.Fb(f)){q(f.F());var w=f.subscribe(v=>{q(f(),v)},null,"arrayChange");w.i(r);return w}return b.j(()=>{var v=b.a.f(f)||[];"undefined"==typeof v.length&&(v=[v]); -q(v)},{i:r})};var k=b.a.c.U(),t=b.a.c.U();b.b.template={init:(e,f)=>{f=b.a.f(f());if("string"==typeof f||"name"in f)b.h.pa(e);else if("nodes"in f){f=f.nodes||[];if(b.N(f))throw Error('The "nodes" option must be a plain, non-observable array.');let h=f[0]&&f[0].parentNode;h&&b.a.c.get(h,t)||(h=b.a.Hb(f),b.a.c.set(h,t,!0));(new b.Ha.Ma(e)).Ga(h)}else if(f=b.h.childNodes(e),0{var q=f();f=b.a.f(q);h=!0;r=null;"string"==typeof f?f={}:(q="name"in f?f.name:e,"if"in f&&(h=b.a.f(f["if"])),h&&"ifnot"in f&&(h=!b.a.f(f.ifnot)),h&&!q&&(h=!1));"foreach"in f?r=b.oc(q,h&&f.foreach||[],f,e,p):h?(h=p,"data"in f&&(h=p.createChildContext(f.data,{as:f.as,exportDependencies:!0})),r=b.nc(q,h,f,e)):b.h.pa(e);p=r;(f=b.a.c.get(e,k))&&"function"==typeof f.m&&f.m();b.a.c.set(e,k,!p||p.fa&&!p.fa()?void 0:p)}};b.D.Na.template=e=>{e=b.D.kc(e); -return 1==e.length&&e[0].unknown||b.D.ic(e,"name")?null:"This template engine does not support anonymous templates nested within its templates"};b.h.Z.template=!0})();b.a.Cb=(a,c,d)=>{if(a.length&&c.length){var g,k,t,e,f;for(g=k=0;(!d||g{function a(c,d,g,k,t){var e=Math.min,f=Math.max,h=[],r,p=c.length,q,l=d.length,n=l-p||1,m=p+l+1,u;for(r=0;r<=p;r++){var w=u;h.push(u= -[]);var v=e(l,r+n);for(q=f(0,r-1);q<=v;q++)u[q]=q?r?c[r-1]===d[q-1]?w[q-1]:e(w[q]||m,u[q-1]||m)+1:q+1:r+1}e=[];f=[];n=[];r=p;for(q=l;r||q;)l=h[r][q]-1,q&&l===h[r][q-1]?f.push(e[e.length]={status:g,value:d[--q],index:q}):r&&l===h[r-1][q]?n.push(e[e.length]={status:k,value:c[--r],index:r}):(--q,--r,t.sparse||e.push({status:"retained",value:d[q]}));b.a.Cb(n,f,!t.dontLimitMoves&&10*p);return e.reverse()}return function(c,d,g){g="boolean"===typeof g?{dontLimitMoves:g}:g||{};c=c||[];d=d||[];return c.length< -d.length?a(c,d,"added","deleted",g):a(d,c,"deleted","added",g)}})();(()=>{function a(g,k,t,e,f){var h=[],r=b.j(()=>{var p=k(t,f,b.a.ya(h,g))||[];if(0!!h.find(b.a.Ua)});return{J:h,Qa:r.fa()?r:void 0}}var c=b.a.c.U(),d=b.a.c.U();b.a.Mb=(g,k,t,e,f,h)=>{function r(C){x= -{$:C,Ba:b.Y(m++)};l.push(x)}function p(C){x=q[C];x.Ba(m++);b.a.ya(x.J,g);l.push(x)}k=k||[];"undefined"==typeof k.length&&(k=[k]);e=e||{};var q=b.a.c.get(g,c),l=[],n=0,m=0,u=[],w=[],v=[],y=0;if(q){if(!h||q&&q._countWaitingForRemove)h=Array.prototype.map.call(q,C=>C.$),h=b.a.xb(h,k,{dontLimitMoves:e.dontLimitMoves,sparse:!0});for(let C=0,z,D,F;z=h[C];C++)switch(D=z.moved,F=z.index,z.status){case "deleted":for(;nC(I,D,z[D].$))})(e.beforeRemove,v);for(k=0;k{var l=h;(q||"").startsWith("after")&&(l=()=>{f=b.v.L(a);setTimeout(h,0)},q=q.slice(5));a.addEventListener(q,l)});var r=k&&"file"==a.type?()=>{var q=b.a.f(c());null==q||""===q?a.value="":b.l.M(h)}:()=>{var q=b.a.f(c()),l=b.v.L(a);if(null!==f&&q===f)setTimeout(r,0);else if(q!==l||void 0===l)g?(l=d.get("valueAllowUnset"),b.v.Ka(a,q,l),l||q===b.v.L(a)||b.l.M(h)):b.v.Ka(a,q)};if(g){var p;b.g.subscribe(a,b.g.A,()=>{p?d.get("valueAllowUnset")?r():h():(a.addEventListener("change", +h),p=b.j(r,{i:a}))},null,{notifyImmediately:!0})}else a.addEventListener("change",h),b.j(r,{i:a})}else b.rb(a,{checkedValue:c})},update:()=>{}};b.D.hb.add("value");b.b.visible={update:(a,c)=>{c=b.a.f(c());var d="none"!=a.style.display;c&&!d?a.style.display="":d&&!c&&(a.style.display="none")}};b.b.hidden={update:(a,c)=>a.hidden=!!b.a.f(c())};(function(a){b.b[a]={init:function(c,d,g,k,t){return b.b.event.init.call(this,c,()=>({[a]:d()}),g,k,t)}}})("click");(()=>{let a=b.a.c.U();class c{constructor(g){this.Sa= +g}Ga(...g){let k=this.Sa;if(!g.length)return b.a.c.get(k,a)||(11===this.B?k.content:1===this.B?k:void 0);b.a.c.set(k,a,g[0])}}class d extends c{constructor(g){super(g);g&&(this.B=g.matches("TEMPLATE")&&g.content?g.content.nodeType:1)}}b.Ha={Sa:d,Ma:c}})();(()=>{function a(e,f){if(e.length){var h=e[0],r=h.parentNode;g(h,e[e.length-1],p=>{1!==p.nodeType&&8!==p.nodeType||b.sb(f,p)});b.a.ya(e,r)}}function c(e,f,h,r){var p=(e&&(e.nodeType?e:0{var r;for(f=b.h.nextSibling(f);e&&(r=e)!==f;)e=b.h.nextSibling(r),h(r,e)};b.nc=function(e,f,h,r){h=h||{};var p=p||"replaceChildren";if(r){var q=r.nodeType?r:0{var l=f&&f instanceof b.aa?f:new b.aa(f,null,null,null,{exportDependencies:!0}),n=d(e,l.$data,l);c(r,p,n,l,h)},{oa:()=>!q||!b.a.Ua(q),i:q})}console.log("no targetNodeOrNodeArray")}; +b.oc=(e,f,h,r,p)=>{function q(v,y){b.l.M(b.a.Mb,null,[r,v,m,h,u,y]);b.g.notify(r,b.g.A)}var l,n=h.as,m=(v,y)=>{l=p.createChildContext(v,{as:n,extend:x=>{x.$index=y;n&&(x[n+"Index"]=y)}});v=d(e,v,l);return c(r,"ignoreTargetNode",v,l,h)},u=(v,y)=>{a(y,l);l=null};if(!h.beforeRemove&&b.Fb(f)){q(f.F());var w=f.subscribe(v=>{q(f(),v)},null,"arrayChange");w.i(r);return w}return b.j(()=>{var v=b.a.f(f)||[];"undefined"==typeof v.length&&(v=[v]);q(v)},{i:r})};var k=b.a.c.U(),t=b.a.c.U();b.b.template={init:(e, +f)=>{f=b.a.f(f());if("string"==typeof f||"name"in f)b.h.pa(e);else if("nodes"in f){f=f.nodes||[];if(b.N(f))throw Error('The "nodes" option must be a plain, non-observable array.');let h=f[0]&&f[0].parentNode;h&&b.a.c.get(h,t)||(h=b.a.Hb(f),b.a.c.set(h,t,!0));(new b.Ha.Ma(e)).Ga(h)}else if(f=b.h.childNodes(e),0{var q= +f();f=b.a.f(q);h=!0;r=null;"string"==typeof f?f={}:(q="name"in f?f.name:e,"if"in f&&(h=b.a.f(f["if"])),h&&"ifnot"in f&&(h=!b.a.f(f.ifnot)),h&&!q&&(h=!1));"foreach"in f?r=b.oc(q,h&&f.foreach||[],f,e,p):h?(h=p,"data"in f&&(h=p.createChildContext(f.data,{as:f.as,exportDependencies:!0})),r=b.nc(q,h,f,e)):b.h.pa(e);p=r;(f=b.a.c.get(e,k))&&"function"==typeof f.m&&f.m();b.a.c.set(e,k,!p||p.fa&&!p.fa()?void 0:p)}};b.D.Na.template=e=>{e=b.D.kc(e);return 1==e.length&&e[0].unknown||b.D.ic(e,"name")?null:"This template engine does not support anonymous templates nested within its templates"}; +b.h.Z.template=!0})();b.a.Cb=(a,c,d)=>{if(a.length&&c.length){var g,k,t,e,f;for(g=k=0;(!d||g{function a(c,d,g,k,t){var e=Math.min,f=Math.max,h=[],r,p=c.length,q,l=d.length,n=l-p||1,m=p+l+1,u;for(r=0;r<=p;r++){var w=u;h.push(u=[]);var v=e(l,r+n);for(q=f(0,r-1);q<=v;q++)u[q]=q?r?c[r-1]===d[q-1]?w[q-1]:e(w[q]||m,u[q-1]||m)+1:q+1:r+1}e=[];f=[];n=[];r=p;for(q=l;r||q;)l= +h[r][q]-1,q&&l===h[r][q-1]?f.push(e[e.length]={status:g,value:d[--q],index:q}):r&&l===h[r-1][q]?n.push(e[e.length]={status:k,value:c[--r],index:r}):(--q,--r,t.sparse||e.push({status:"retained",value:d[q]}));b.a.Cb(n,f,!t.dontLimitMoves&&10*p);return e.reverse()}return function(c,d,g){g="boolean"===typeof g?{dontLimitMoves:g}:g||{};c=c||[];d=d||[];return c.length{function a(g,k,t,e,f){var h=[],r=b.j(()=>{var p=k(t,f,b.a.ya(h, +g))||[];if(0!!h.find(b.a.Ua)});return{J:h,Qa:r.fa()?r:void 0}}var c=b.a.c.U(),d=b.a.c.U();b.a.Mb=(g,k,t,e,f,h)=>{function r(C){x={$:C,Ba:b.Y(m++)};l.push(x)}function p(C){x=q[C];x.Ba(m++);b.a.ya(x.J,g);l.push(x)}k=k||[];"undefined"==typeof k.length&&(k=[k]);e=e|| +{};var q=b.a.c.get(g,c),l=[],n=0,m=0,u=[],w=[],v=[],y=0;if(q){if(!h||q&&q._countWaitingForRemove)h=Array.prototype.map.call(q,C=>C.$),h=b.a.xb(h,k,{dontLimitMoves:e.dontLimitMoves,sparse:!0});for(let C=0,z,D,F;z=h[C];C++)switch(D=z.moved,F=z.index,z.status){case "deleted":for(;nC(I,D,z[D].$))})(e.beforeRemove,v);for(k=0;k 0 && element.lookupNamespaceURI(attrName.substr(0, prefixLen)); + var namespace = "lookupNamespaceURI" in element && prefixLen > 0 && element.lookupNamespaceURI(attrName.slice(0, prefixLen)); // To cover cases like "attr: { checked:someProp }", we want to remove the attribute entirely // when someProp is a "no value"-like value (strictly null, false, or undefined) diff --git a/vendors/knockout/src/binding/defaultBindings/value.js b/vendors/knockout/src/binding/defaultBindings/value.js index 76820b24f..41fadebbd 100644 --- a/vendors/knockout/src/binding/defaultBindings/value.js +++ b/vendors/knockout/src/binding/defaultBindings/value.js @@ -49,7 +49,7 @@ ko.bindingHandlers['value'] = { elementValueBeforeEvent = ko.selectExtensions.readValue(element); setTimeout(valueUpdateHandler, 0); }; - eventName = eventName.substring(5); + eventName = eventName.slice(5); } registerEventHandler(eventName, handler); }); diff --git a/vendors/knockout/src/binding/expressionRewriting.js b/vendors/knockout/src/binding/expressionRewriting.js index 270834387..be488398e 100644 --- a/vendors/knockout/src/binding/expressionRewriting.js +++ b/vendors/knockout/src/binding/expressionRewriting.js @@ -84,7 +84,7 @@ ko.expressionRewriting = (() => { var match = toks[i-1].match(divisionLookBehind); if (match && !keywordRegexLookBehind[match[0]]) { // The slash is actually a division punctuator; re-parse the remainder of the string (not including the slash) - str = str.substr(str.indexOf(tok) + 1); + str = str.slice(str.indexOf(tok) + 1); toks = str.match(bindingToken); i = -1; // Continue with just the slash