From 644c8ad3899c7bad86bfa4faa0c3c19b8f51e4f3 Mon Sep 17 00:00:00 2001
From: the-djmaze <>
Date: Mon, 4 Mar 2024 01:12:40 +0100
Subject: [PATCH] `new Error` to `Error`
---
.../build/output/knockout-latest.debug.js | 44 +++++++++----------
.../src/binding/bindingAttributeSyntax.js | 6 +--
.../src/binding/defaultBindings/options.js | 2 +-
.../src/binding/defaultBindings/submit.js | 2 +-
.../src/components/componentBinding.js | 6 +--
.../knockout/src/components/loaderRegistry.js | 6 +--
.../src/subscribables/dependencyDetection.js | 2 +-
.../src/subscribables/dependentObservable.js | 2 +-
.../src/subscribables/observableArray.js | 2 +-
vendors/knockout/src/templating/templating.js | 8 ++--
vendors/knockout/src/utils.domNodeDisposal.js | 2 +-
vendors/knockout/src/utils.js | 2 +-
vendors/knockout/src/virtualElements.js | 4 +-
13 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/vendors/knockout/build/output/knockout-latest.debug.js b/vendors/knockout/build/output/knockout-latest.debug.js
index ddfbf934d..f7fa32710 100644
--- a/vendors/knockout/build/output/knockout-latest.debug.js
+++ b/vendors/knockout/build/output/knockout-latest.debug.js
@@ -110,7 +110,7 @@ ko.utils = {
triggerEvent: (element, eventType) => {
if (!element?.nodeType)
- throw new Error("element must be a DOM node when calling triggerEvent");
+ throw Error("element must be a DOM node when calling triggerEvent");
element.dispatchEvent(new Event(eventType));
},
@@ -197,7 +197,7 @@ ko.utils.domNodeDisposal = (() => {
return {
'addDisposeCallback' : (node, callback) => {
if (typeof callback != "function")
- throw new Error("Callback must be a function");
+ throw Error("Callback must be a function");
getDisposeCallbacksCollection(node, 1).add(callback);
},
@@ -482,7 +482,7 @@ ko.dependencyDetection = {
registerDependency: subscribable => {
if (currentFrame) {
if (!ko.isSubscribable(subscribable))
- throw new Error("Only subscribable things can act as dependencies");
+ throw Error("Only subscribable things can act as dependencies");
currentFrame.callback.call(currentFrame.callbackTarget, subscribable,
subscribable._id || (subscribable._id = ++lastId));
}
@@ -585,7 +585,7 @@ ko['observableArray'] = initialValues => {
initialValues = initialValues || [];
if (!Array.isArray(initialValues))
- throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
+ throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
return Object.setPrototypeOf(ko.observable(initialValues), ko['observableArray']['fn']).extend({'trackArrayChanges':true});
};
@@ -831,7 +831,7 @@ ko.computed = (evaluatorFunctionOrOptions, options) => {
function computedObservable() {
if (arguments.length > 0) {
if (typeof writeFunction !== "function") {
- throw new Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
+ throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
}
// Writing a value
writeFunction(...arguments);
@@ -1520,7 +1520,7 @@ ko.expressionRewriting = (() => {
++depth;
}
if (!allowUnbalanced)
- throw new Error("Cannot find closing comment tag to match: " + startComment.nodeValue);
+ throw Error("Cannot find closing comment tag to match: " + startComment.nodeValue);
return null;
}
@@ -1575,7 +1575,7 @@ ko.expressionRewriting = (() => {
}
let first = node.firstChild;
if (first && isEndComment(first)) {
- throw new Error("Found invalid end comment, as the first child of " + node);
+ throw Error("Found invalid end comment, as the first child of " + node);
}
return first;
},
@@ -1843,7 +1843,7 @@ ko.bindingEvent = {
} else if (bindingInfo.asyncContext === undefined && bindingInfo.eventSubscribable?.hasSubscriptionsForEvent(ko.bindingEvent.descendantsComplete)) {
// It's currently an error to register a descendantsComplete handler for a node that was never registered as completing asynchronously.
// That's because without the asyncContext, we don't have a way to know that all descendants have completed.
- throw new Error("descendantsComplete event not supported for bindings on this node");
+ throw Error("descendantsComplete event not supported for bindings on this node");
}
}
}
@@ -2021,7 +2021,7 @@ function applyBindingsToNodeInternal(node, sourceBindings, bindingContext) {
// COMMENT_NODE
if (node.nodeType === 8 && !ko.virtualElements.allowedBindings[bindingKey]) {
- throw new Error("The binding '" + bindingKey + "' cannot be used with comment nodes");
+ throw Error("The binding '" + bindingKey + "' cannot be used with comment nodes");
}
try {
@@ -2033,7 +2033,7 @@ function applyBindingsToNodeInternal(node, sourceBindings, bindingContext) {
// If this binding handler claims to control descendant bindings, make a note of this
if (initResult && initResult['controlsDescendantBindings']) {
if (bindingHandlerThatControlsDescendantBindings !== undefined)
- throw new Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
+ throw Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
bindingHandlerThatControlsDescendantBindings = bindingKey;
}
});
@@ -2133,11 +2133,11 @@ ko.exportSymbol('applyBindings', ko.applyBindings);
'register': (componentName, config) => {
if (!config) {
- throw new Error('Invalid configuration for ' + componentName);
+ throw Error('Invalid configuration for ' + componentName);
}
if (defaultConfigRegistry[componentName]) {
- throw new Error('Component ' + componentName + ' is already registered');
+ throw Error('Component ' + componentName + ' is already registered');
}
defaultConfigRegistry[componentName] = config;
@@ -2156,7 +2156,7 @@ ko.exportSymbol('applyBindings', ko.applyBindings);
var defaultConfigRegistry = Object.create(null),
createViewModelKey = 'createViewModel',
- throwError = (componentName, message) => { throw new Error(`Component '${componentName}': ${message}`) },
+ throwError = (componentName, message) => { throw Error(`Component '${componentName}': ${message}`) },
// Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it
// into the standard component definition format:
@@ -2237,7 +2237,7 @@ ko.exportSymbol('applyBindings', ko.applyBindings);
}
if (!componentName) {
- throw new Error('No component name specified');
+ throw Error('No component name specified');
}
var asyncContext = ko.bindingEvent.startPossiblyAsyncContentBinding(element, bindingContext);
@@ -2251,12 +2251,12 @@ ko.exportSymbol('applyBindings', ko.applyBindings);
// Instantiate and bind new component. Implicitly this cleans any old DOM nodes.
if (!componentDefinition) {
- throw new Error('Unknown component \'' + componentName + '\'');
+ throw Error('Unknown component \'' + componentName + '\'');
}
// cloneTemplateIntoElement
var template = componentDefinition['template'];
if (!template) {
- throw new Error('Component \'' + componentName + '\' has no template');
+ throw Error('Component \'' + componentName + '\' has no template');
}
ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(template));
@@ -2642,7 +2642,7 @@ var captionPlaceholder = {};
ko.bindingHandlers['options'] = {
'init': element => {
if (!element.matches("SELECT"))
- throw new Error("options binding applies only to SELECT elements");
+ throw Error("options binding applies only to SELECT elements");
// Remove all existing