#7288 closed bug (patchwelcome)
warning and errors in jquery core code
Reported by: | aquananu | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | core | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
please test jquery on any page and browse the page in mozilla firefox and see the warnings in error console.
Few of them are Warning: anonymous function does not always return a value
Rest to be attended are as below
----------
Warning: reference to undefined property window.jQuery Source file: Line: 29
----------
Warning: reference to undefined property window.jQuery Source file: Line: 29
----------
Warning: reference to undefined property window.$ Source file: Line: 32
----------
Warning: reference to undefined property window.$ Source file: Line: 32
----------
Warning: reference to undefined property elem[jQuery.expando] Source file: Line: 1137
----------
Warning: reference to undefined property elem[jQuery.expando] Source file: Line: 1137
Change History (18)
comment:1 Changed 13 years ago by
Component: | unfiled → core |
---|---|
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 13 years ago by
please use report strict warnings option in firefox, then these warning will show up
comment:4 Changed 13 years ago by
Description: | modified (diff) |
---|---|
Priority: | undecided → high |
Resolution: | invalid |
Status: | closed → reopened |
reopening for review - thanks for the additional information
comment:6 Changed 13 years ago by
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
None of these warnings are things anyone should care about, since it’s perfectly legitimate to access undefined properties on objects. Strict warnings are red herrings.
comment:7 Changed 12 years ago by
I like my code to be as clean as possible. Hence I enable strict warnings for my code. Now with that many messages of jquery my console is bloated with 'red herrings'.
Please ... clean up. it IS legitimate to access an uninitialized variable in C too but it generally is case for errors
comment:8 Changed 12 years ago by
I agree with the previous comment. This should be fixed, not ignored.
comment:10 Changed 12 years ago by
I am experiencing the same problem and quite frankly to say something like "None of these warnings are things anyone should care about," is ridiculous, and not in keeping with the high standards we as end users have come to expect from jQuery.
Please sort this out.
comment:11 Changed 12 years ago by
wontfix is not acceptable. I use a function "isset" instead of crashing on "undefined". Lazy programing not expected from JQuery.
Unable to debug my code "Break on Next" keeps breaking for JQuery errors.
wontfix is a call for disrespectful comments to the specific programmer (snover).
comment:12 Changed 12 years ago by
We're not irresponsible, you simply don't understand a point of view that is not you're own.
http://hacks.mozilla.org/2011/01/ecmascript-5-strict-mode-in-firefox-4/
comment:13 Changed 12 years ago by
How about we reopen this and close it patchwelcome? It seems like there are lots of people willing to fix it who have posted here. If you have fixed this problem, please post a link to your fix, or add a pull request at GitHub. Thanks!
comment:14 Changed 12 years ago by
Milestone: | 1.5 |
---|---|
Resolution: | wontfix |
Status: | closed → reopened |
comment:15 Changed 12 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | reopened → closed |
You're right Dave, if someone wants to step up and fix the problem - by all means.
comment:16 Changed 12 years ago by
Not ready to jump into the jquery source code myself, but how about checking for frequently missing properties before accessing. For instance, change:
"f=e?a[c.expando]:null,..."
to:
"f=e&&("expando" in c)?a[c.expando]:null,..."
or, if it makes sense to use a default index when f=e:
"f=e?a[c.safetyCheckIndexProp('expando')]:null,..."
where obj.safetyCheckIndexProp(String nameOfProp) returns a reserved value, like 0, if the property doesn't exist, otherwise, returns the prop value.
Ref: http://www.nczonline.net/blog/2010/07/27/determining-if-an-object-property-exists/ "if ('expando' in c){ property exists }"
comment:17 follow-up: 18 Changed 12 years ago by
A possible fix is to change the hasData function to :
hasData: function( elem ) { elem = elem.nodeType ? (elem[jQuery.expando]?jQuery.cache[ elem[jQuery.expando] ]:null) : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); },
It fixes errors generated in forefox(tested on firefox 7.0.1)
comment:18 Changed 12 years ago by
Replying to quamis:
A possible fix is to change the hasData function to :
hasData: function( elem ) { elem = elem.nodeType ? (elem[jQuery.expando]?jQuery.cache[ elem[jQuery.expando] ]:null) : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); },It fixes errors generated in forefox(tested on firefox 7.0.1)
Then it reveals an like wise error at this line:
id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
My error console is completely empty when attempting to recreate this issue.
Tested in Firefox 3.6.11 & Firefox 4b6