Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

jquery

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:

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

(IE10) Unable to get property 'createDocumentFragment' of undefined or null reference jquery-1.9.1.js, line 5823 character 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:

<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.

like image 854
Santosh Avatar asked Apr 03 '13 14:04

Santosh


2 Answers

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:

// 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.js before jquery ui. That will also take care of priority.

like image 110
Daniel Lidström Avatar answered Nov 08 '22 09:11

Daniel Lidström


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

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.

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

like image 30
Mike Castro Demaria Avatar answered Nov 08 '22 09:11

Mike Castro Demaria