Bug Tracker

Ticket #7089 (closed bug: invalid)

Opened 4 years ago

Last modified 3 years ago

handleobj is undefined

Reported by: mrbrdo Owned by:
Priority: undecided Milestone: 1.4.3
Component: event Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

Description

production version error = u is undefined.

The problem occured to me when calling .load on an img element. The img element was then removed and added again (with same id) and the .load event added again - this time I got the error. So not the first time but the second. Tested in Firefox and some other browsers aswell.

The fix is easy: on line 1737 change

if ( all
namespace.test( handleObj.namespace ) ) {

to

if ( handleObj && (all
namespace.test( handleObj.namespace )) ) {

Error goes away, everything is ok.

Change History

comment:1 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to invalid
  • Component changed from unfiled to event

Do you have a simplified test case for this? I'm not entirely sure what you're referring to.

comment:2 Changed 4 years ago by mrbrdo

  • Status changed from closed to reopened
  • Resolution invalid deleted

I cannot simplify it, but here is the problematic example:  http://www.mrbrdo.net/tmp/jquery-bug/index.htm Click on a thumbnail image at the bottom. The first time this will work ok, but the second time (e.g. click another thumbnail after that), the error will be thrown. If that line is changed in jquery which I mentioned above, the error goes away (not sure if it is the proper fix though). Relevant code is in the gallery.js file.

comment:3 Changed 4 years ago by dmethvin

  • Status changed from reopened to closed
  • Resolution set to invalid

This is most likely due to modifying Object.prototype, I saw an instance of that in ./index_files/json.js included by your page.

comment:4 follow-up: ↓ 5 Changed 3 years ago by me@…

I just had this same error in 1.5 (after calling .remove()), and the proposed fix works. Yes, I had extended Object.prototype - is this a situation where jQuery is supposed to fail?

comment:5 in reply to: ↑ 4 Changed 3 years ago by jitter

Replying to me@…:

I just had this same error in 1.5 (after calling .remove()), and the proposed fix works. Yes, I had extended Object.prototype - is this a situation where jQuery is supposed to fail?

Modifying Object.prototype is verboten. As it has all kinds of negative side effects. jQuery is not supported on pages where other code messes with Object.prototype.

Last edited 3 years ago by jitter (previous) (diff)

comment:6 in reply to: ↑ description Changed 3 years ago by vladnicula@…

I found the same error on line 2744 in jquery.1.6.2.js when destroying the second time an item with the same Id when using jasmine BDD for JavaScript.

I added a handlerObj !== undefined to escape this error.

Note: See TracTickets for help on using tickets.