Visual Studio jscript intellisense error with jQuery 1.2.6?
-
03-07-2019 - |
Question
I get the warning "childNodes is null or not an object' with different line numbers, depending on which version of the library I reference (I've tried about three different versions of 1.2.6). Consequently, I get jack for jQuery intellisense.
I can hack this to get it to work, but I'd rather not as I don't understand the full implications of changing the following line:
elem = jQuery.makeArray(div.childNodes);
to this:
//HACK: VS intellisense fix
if(div && div.childNodes)
elem = jQuery.makeArray(div.childNodes);
(The changed line only appears once in the source). What gives?
Solution
Have you tried adding a reference to the documentation-only file available here? jQuery IntelliSense in Visual Studio 2008
OTHER TIPS
I ran into this same issue a little while back. Are you using the jQuery UI files as well? I was and it turned out that the jquery ui javascript file was messing up the intellisense somehow. So I created an empty vsdoc.js file for the jquery ui file and then intellisense started working. My jquery ui file was called jquery-ui-personalized-1.6rc2.min.js. Creating a file called jquery-ui-personalized-1.6rc2.min-vsdoc.js fixed the issue.
I was also using jquery-jtemplates.js but that did not seem to cause a problem. I think it is just the jquery-ui file.
It does work for me; Not sure why it is an error for me and why the fix is needed?