Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tracking down cause of JQuery errors 1

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
0
0
GB
Hi,

I have an error that occasionally appears in the FireFox error console...

TypeError: g.nodeName is undefined jquery-1.7.1.min.js:2

How do I track the actual cause of the error?

Thanks,
1DMF

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Find out what object 'g' is a reference to and start there.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
How do I go about doing that?

'g' isn't the name of any variable I'm using, where and what do I output to console.log()?

Is there a feature of the console I'm not familiar with that I can use to find this information?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
'g' isn't the name of any variable I'm using,

Somebody is and if it ain't you ... why does it matter?

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Somebody is ...
yes, JQuery I believe. I'm the only one writing JS code here and I have never used a single letter variable in my life other than i,x type loop counter vars.

... why does it matter?

because it's an error in the error console. I'm meant to care aren't I?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
because it's an error in the error console. I'm meant to care aren't I?
Only if it's your fault.

If the errors are nothing to do with your code, how are you going to fix them if you do find them??

Some could be DOM "fail-over" testing in the library itself. ... Nothing you can do
Some could be the console trying to get browser capability data. ... Nothing you can do.


It's simple. There are two kinds of problem:

Ones you can fix and ones that you can't. So fix the ones you can and stop fretting over the ones you can't.

Obsessing over every little tiny thing is the best way to get a nice new coat ... one with sleeves that tie at the back.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Obsessing over every little tiny thing is the best way to get a nice new coat ... one with sleeves that tie at the back.
Well I could do with a new winter jacket [lol]

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
ChrisHirst said:
Only if it's your fault.

Strongly disagree. Your application, your fault. No matter if the fault is in your code or in an external library. Either you made a mistake programmig or choosing the tools, but it's still your mistake.

This is the main flaw I find in JQuery, that is a nightmare to debug if you have a problem, but even id the error occurs in one of the evily obfuscated piece of code, the actual problem use to be in your own code, as JQuery is widely used and tested.

What I normally do is looking at the stack in the debugger, that usually points to somewhere in your code.

Cheers,
Dian
 
Dian,

Any where, any time ANY application tests for the existence of a function, method, attribute, element name, element ID THERE WILL be an error raised. This is fundamental to ensuring cross browser compatibility and having it so that such 'issues' DO NOT prevent the application from functioning correctly or appropriately under ALL conditions.

Whatever is creating the error IS being handled by the application RATHER than bringing down the browser.

If you open the browser console on ANY page that uses Google Analytics you WILL find error messages as the code inspects the browser capabilities so it can report it accurately. This NOT a problem that YOU can 'fix', it is NOT a problem that Google can 'fix'. It is NOT even a 'problem' it IS simply a function of the code in determining what can be done or how it can be done TO PREVENT ERRORS from occurring!


So, if you want to spend your time worrying about, or trying to fix something that YOU have NO control over and is NOT actually causing a problem, feel free, but please don't expect everybody to do the same.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top