Skip to main content

Bug Tracker

Side navigation

#7288 closed bug (patchwelcome)

Opened October 22, 2010 06:04PM UTC

Closed April 11, 2011 06:50PM UTC

Last modified October 08, 2011 08:13PM UTC

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

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

Attachments (0)
Change History (18)

Changed October 22, 2010 06:34PM UTC by rwaldron comment:1

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

Changed October 23, 2010 05:59AM UTC by me@aquananu.com comment:2

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

Changed October 24, 2010 02:16PM UTC by charles.des@gmail.com comment:3

Having the same thing.

Changed October 24, 2010 03:23PM UTC by rwaldron comment:4

description: 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: http://localhost/status/scripts/jquery-1.4.3.js \ Line: 29 \ ---------- \ Warning: reference to undefined property window.jQuery \ Source file: http://localhost/status/scripts/jquery-1.4.3.js \ Line: 29 \ ---------- \ Warning: reference to undefined property window.$ \ Source file: http://localhost/status/scripts/jquery-1.4.3.js \ Line: 32 \ ---------- \ Warning: reference to undefined property window.$ \ Source file: http://localhost/status/scripts/jquery-1.4.3.js \ Line: 32 \ ---------- \ Warning: reference to undefined property elem[jQuery.expando] \ Source file: http://localhost/status/scripts/jquery-1.4.3.js \ Line: 1137 \ ---------- \ Warning: reference to undefined property elem[jQuery.expando] \ Source file: http://localhost/status/scripts/jquery-1.4.3.js \ Line: 1137 \ 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 \
priority: undecidedhigh
resolution: invalid
status: closedreopened

reopening for review - thanks for the additional information

Changed November 02, 2010 09:54AM UTC by anonymous comment:5

Having the same thing. +1

Changed November 18, 2010 09:13PM UTC by snover comment:6

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.

Changed February 06, 2011 10:00PM UTC by anonymous comment:7

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

Changed March 10, 2011 03:09AM UTC by anonymous comment:8

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

Changed March 10, 2011 03:21AM UTC by slavixtube comment:9

Please reopen and fix.

Changed April 11, 2011 04:53AM UTC by anonymous comment:10

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.

Changed April 11, 2011 05:56PM UTC by basdub comment:11

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).

Changed April 11, 2011 06:27PM UTC by rwaldron comment:12

_comment0: 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.html1302546485499810

We're not irresponsible, you simply don't understand a point of view that is not your own.

http://hacks.mozilla.org/2011/01/ecmascript-5-strict-mode-in-firefox-4/

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

Changed April 11, 2011 06:42PM UTC by dmethvin comment:13

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!

Changed April 11, 2011 06:49PM UTC by rwaldron comment:14

milestone: 1.5
resolution: wontfix
status: closedreopened

Changed April 11, 2011 06:50PM UTC by rwaldron comment:15

resolution: → patchwelcome
status: reopenedclosed

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

Changed June 28, 2011 04:15PM UTC by kdolan@dce.harvard.edu comment:16

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 }"

Changed October 01, 2011 09:42AM UTC by quamis comment:17

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)

Changed October 08, 2011 08:13PM UTC by anonymous comment:18

Replying to [comment:17 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;