Skip to main content

Bug Tracker

Side navigation

#6801 closed bug (duplicate)

Opened July 19, 2010 06:34AM UTC

Closed October 25, 2010 07:22PM UTC

Last modified October 25, 2010 07:22PM UTC

jQuery.event.add() does not check against undefined handlers

Reported by: hyponiq Owned by:
Priority: undecided Milestone: 1.4.2
Component: event Version: 1.4.2
Keywords: event, handler Cc:
Blocked by: Blocking:
Description

This is a cross browser issue:

jQuery.event.add() does not check whether 'handler' has been defined. An error is thrown (in (at least) all major browser) when properties of 'handler' are attempted be accessed on an undefined object.

Attachments (0)
Change History (4)

Changed July 19, 2010 06:46AM UTC by hyponiq comment:1

I have, in my own copy of jQuery, fixed the issue (for brevity, irrelevant material replaced with "

// ... rest ... //
"):

jQuery.event = {
	// Bind an event to an element
	// Original by Dean Edwards
	add: function( elem, types, handler, data ) {
                // ... rest ... //
                
		// bug found where on certain occasions, 'hander' is undefined
		if ( handler === undefined ) {
			return;
		}
                
                // ... rest ... //
	},
        
        // ... rest ... //
};

Changed July 21, 2010 02:37AM UTC by dmethvin comment:2

Can you provide a test case?

Changed October 25, 2010 07:22PM UTC by rwaldron comment:3

priority: → undecided
resolution: → duplicate
status: newclosed

Changed October 25, 2010 07:22PM UTC by rwaldron comment:4

Duplicate of #7229.