Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#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 Rick Waldron)

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 Rick Waldron

Component: unfiledcore
Resolution: invalid
Status: newclosed

My error console is completely empty when attempting to recreate this issue.

Tested in Firefox 3.6.11 & Firefox 4b6

comment:2 Changed 13 years ago by me@…

please use report strict warnings option in firefox, then these warning will show up

comment:3 Changed 13 years ago by charles.des@…

Having the same thing.

comment:4 Changed 13 years ago by Rick Waldron

Description: modified (diff)
Priority: undecidedhigh
Resolution: invalid
Status: closedreopened

reopening for review - thanks for the additional information

comment:5 Changed 13 years ago by anonymous

Having the same thing. +1

comment:6 Changed 13 years ago by snover

Resolution: wontfix
Status: reopenedclosed

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 anonymous

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 anonymous

I agree with the previous comment. This should be fixed, not ignored.

comment:9 Changed 12 years ago by slavixtube

Please reopen and fix.

comment:10 Changed 12 years ago by anonymous

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 basdub

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 Rick Waldron

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/

http://www.howtocreate.co.uk/strictJSFirefox.html

Version 0, edited 12 years ago by Rick Waldron (next)

comment:13 Changed 12 years ago by dmethvin

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 Rick Waldron

Milestone: 1.5
Resolution: wontfix
Status: closedreopened

comment:15 Changed 12 years ago by Rick Waldron

Resolution: patchwelcome
Status: reopenedclosed

You're right Dave, if someone wants to step up and fix the problem - by all means.

comment:16 Changed 12 years ago by kdolan@…

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 Changed 12 years ago by 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)

comment:18 in reply to:  17 Changed 12 years ago by anonymous

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;

Note: See TracTickets for help on using tickets.