From 7d97ae3145d8bebf5b59b59db531a38c20ee82cb Mon Sep 17 00:00:00 2001 From: djmaze Date: Tue, 28 Sep 2021 13:20:54 +0200 Subject: [PATCH] Replace ko.utils.stringStartsWith with native String.startsWith --- vendors/knockout/src/binding/defaultBindings/value.js | 2 +- vendors/knockout/src/utils.js | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/vendors/knockout/src/binding/defaultBindings/value.js b/vendors/knockout/src/binding/defaultBindings/value.js index 64b23d3d5..af7535d23 100644 --- a/vendors/knockout/src/binding/defaultBindings/value.js +++ b/vendors/knockout/src/binding/defaultBindings/value.js @@ -35,7 +35,7 @@ ko.bindingHandlers['value'] = { // This is useful, for example, to catch "keydown" events after the browser has updated the control // (otherwise, ko.selectExtensions.readValue(this) will receive the control's value *before* the key event) var handler = valueUpdateHandler; - if (ko.utils.stringStartsWith(eventName, "after")) { + if ((eventName||'').startsWith("after")) { handler = () => { // The elementValueBeforeEvent variable is non-null *only* during the brief gap between // a keyX event firing and the valueUpdateHandler running, which is scheduled to happen diff --git a/vendors/knockout/src/utils.js b/vendors/knockout/src/utils.js index 7623819c7..1c9807a4f 100644 --- a/vendors/knockout/src/utils.js +++ b/vendors/knockout/src/utils.js @@ -89,13 +89,6 @@ ko.utils = { string.trim() : string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, ''), - stringStartsWith: (string, startsWith) => { - string = string || ""; - if (startsWith.length > string.length) - return false; - return string.substring(0, startsWith.length) === startsWith; - }, - domNodeIsContainedBy: (node, containedByNode) => containedByNode.contains(node.nodeType !== 1 ? node.parentNode : node),