jQuery 1.9.1 无法获取未定义或空引用的属性 'createDocumentFragment' 第 5823 行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15790568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 15:49:02  来源:igfitidea点击:

jQuery 1.9.1 Unable to get property 'createDocumentFragment' of undefined or null reference Line 5823

jquery

提问by Santosh

Recently I updated my ASP.Net MVC4 project to upgrade to jQuery 1.9.1. But since then I am getting a strange error as soon as any page is loaded:

最近我更新了我的 ASP.Net MVC4 项目以升级到 jQuery 1.9.1。但从那以后,只要加载任何页面,我就会收到一个奇怪的错误:

(Chrome) jquery-1.9.1.js:5823 Uncaught TypeError: Cannot call method 'createDocumentFragment' of null

(Chrome) jquery-1.9.1.js:5823 未捕获的类型错误:无法调用 null 的方法“createDocumentFragment”

(IE10) Unable to get property 'createDocumentFragment' of undefined or null reference jquery-1.9.1.js, line 5823 character 3

(IE10) 无法获取未定义或空引用的属性“createDocumentFragment”jquery-1.9.1.js,第 5823 行字符 3

The 'document' parameter being passed to its parent function createSafeFragment( document ) is always null. The error is persistent in IE10 as well as Chrome. Below is how scripts are included in the layout:

传递给其父函数 createSafeFragment( document ) 的“文档”参数始终为空。该错误在 IE10 和 Chrome 中持续存在。以下是布局中包含脚本的方式:

<script src="/Scripts/jquery-1.9.1.js"></script>
<script src="/Scripts/jquery-ui-1.10.2.js"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/Scripts/bootstrap.js"></script>

I tried to trace the error by debugging the scripts but could not find the exact source.

我试图通过调试脚本来跟踪错误,但找不到确切的来源。

Has anybody come across this with any breakthrough? Any help is appreciated.

有没有人遇到过这个有任何突破?任何帮助表示赞赏。



UPDATE

更新



jQuery Tooltip was conflicting with Bootstrap Tooltip. Changed the functionality to use Bootstrap and the error has gone.

jQuery Tooltip 与 Bootstrap Tooltip 冲突。更改了使用 Bootstrap 的功能,错误消失了。

回答by Mike Castro Demaria

You have simply a conflict between bootstrap and jQuery UI tooltips features.

您在引导程序和 jQuery UI 工具提示功能之间存在冲突。

You can't use booth tooltips feature on the same display. For any choose one and go to customize the other to remove tooltips feature. Remove all other duplicated none-useful features (not useful to use dialog from JQUI or BT too). Download the modified package and replace the .js file in your js directory.

您不能在同一显示器上使用展位工具提示功能。对于任何选择一个并去自定义另一个以删除工具提示功能。删除所有其他重复的无用功能(也不适用于使用来自 JQUI 或 BT 的对话框)。下载修改后的包并替换 js 目录中的 .js 文件。

Unchecked unneeded features from : Boostrap customize packageor jQuery UI customize package

未经检查的不需要的功能来自:Boostrap 定制包jQuery UI 定制包

回答by Daniel Lidstr?m

There's no need to remove $(document).tooltip();. Probably you are intending to use jQuery ui tooltip instead of Bootstrap tooltip. Use these lines to revert Bootstrap override:

没有必要删除$(document).tooltip();。可能您打算使用 jQuery ui 工具提示而不是 Bootstrap 工具提示。使用这些行来恢复 Bootstrap 覆盖:

// return $.fn.tooltip to previously assigned value
var bootstrapTooltip = $.fn.tooltip.noConflict();

// give $().bootstrapTooltip the Bootstrap functionality
$.fn.bootstrapTooltip = bootstrapTooltip

// now activate tooltip plugin from jQuery ui
$(document).tooltip();

Alternatively, make sure you are including bootstrap.jsbeforejquery ui. That will also take care of priority.

或者,确保bootstrap.jsjquery ui之前包含。这也将优先考虑。