gpt4 book ai didi

javascript - IE8 knockout 3.3.0错误

转载 作者:行者123 更新时间:2023-11-28 00:09:30 27 4
gpt4 key购买 nike

我不确定是什么原因导致的,但 IE8 指出这段代码中的 catch 行导致了一个错误,导致页面无法加载。我真的不知道是什么原因造成的。我什至将所有保留关键字用引号引起来,以避免 knockout 中的冲突。

ko.utils.arrayForEach(orderedBindings, function(bindingKeyAndHandler) {
// Note that topologicalSortBindings has already filtered out any nonexistent binding handlers,
// so bindingKeyAndHandler.handler will always be nonnull.
var handlerInitFn = bindingKeyAndHandler.handler["init"],
handlerUpdateFn = bindingKeyAndHandler.handler["update"],
bindingKey = bindingKeyAndHandler.key;

if (node.nodeType === 8) {
validateThatBindingIsAllowedForVirtualElements(bindingKey);
}

try {
// Run init, ignoring any dependencies
if (typeof handlerInitFn == "function") {
ko.dependencyDetection.ignore(function() {
var initResult = handlerInitFn(node, getValueAccessor(bindingKey), allBindings, bindingContext['$data'], 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.");
bindingHandlerThatControlsDescendantBindings = bindingKey;
}
});
}

// Run update in its own computed wrapper
if (typeof handlerUpdateFn == "function") {
ko.dependentObservable(
function() {
handlerUpdateFn(node, getValueAccessor(bindingKey), allBindings, bindingContext['$data'], bindingContext);
},
null,
{ disposeWhenNodeIsRemoved: node }
);
}
} catch (ex) {
ex.message = "Unable to process binding \"" + bindingKey + ": " + bindings[bindingKey] + "\"\nMessage: " + ex.message;
throw ex;
}
});

最佳答案

如果您在项目中使用过 Knockout.js,那么您可能在某些时候遇到过以下错误“Uncaught ReferenceError:无法处理绑定(bind)”。最可能的原因是某处出现拼写错误或忘记更改上下文。您位于 foreach 绑定(bind)中并且忘记使用 $parent。

这可能会导致进一步的innerHtml错误,从而阻止页面加载js。

关于javascript - IE8 knockout 3.3.0错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31029653/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com