views:

1398

answers:

3

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?

A: 

Have you tried adding a reference to the documentation-only file available here? jQuery IntelliSense in Visual Studio 2008

Herb Caudill
I've used one of many commented versions of 1.2.6. They all result in the same error blocking any intellisense from working without the hack.
Will
Marking this as the answer because the new support for intellisense in jquery fixes this.
Will
A: 

It does work for me; Not sure why it is an error for me and why the fix is needed?

+4  A: 

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.

Erikk Ross
+1 to this. Thanks! This jquery UI issue was really getting me down!
Chris Farmer
THANK YOU!!! This solved my problem... I've been going back and forth with this, sometimes it works, sometimes it doesn't... never tracked it directly back to the JQuery UI though, but adding the empty vsdoc.js file fixed it for me!
Max Schilling