我在我的android应用程序中使用jquery。当我在2.1,3.0上测试它时,我成功运行了我的项目,但是当我用4.1测试它时,它显示我的错误,如“错误调用NPObject上的方法”所以请建议我,如果版本更改时jquery或任何js需要任何。我在这里描述了我实际得到错误的代码,实际上我是从jquery.min.js粘贴代码。
我在这个方法的第3行遇到错误:
function warn(message) {
if (window.console !== undefined && jQTSettings.debug === true) {
console.warn(message);
}
}
,此方法来自:
// Unfortunately, we can not assume the "tap" event
// is being used for links, forms, etc.
function clickHandler(e) {
// Figure out whether to prevent default
var $el = $(e.target);
// Find the nearest tappable ancestor
if (!$el.is(touchSelectors.join(', '))) {
$el = $(e.target).closest(touchSelectors.join(', '));
}
// Prevent default if we found an internal link (relative or absolute)
if ($el && $el.prop('href') && !$el.isExternalLink()) {
warn('Need to prevent default click behavior');
e.preventDefault();
} else {
warn('No need to prevent default click behavior');
}
// Trigger a tap event if touchstart is not on the job
if ($.support.touch) {
warn('Not converting click to a tap event because touch handler is on the job');
} else {
warn('Converting click event to a tap event because touch handlers are not present or off');
$(e.target).trigger('tap', e);
}
}
请建议我如何摆脱这个错误。