Bug Tracker

Modify

Ticket #6801 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 3 years ago by hyponiq

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 ... //
};

comment:2 Changed 3 years ago by dmethvin

Can you provide a test case?

comment:3 Changed 3 years ago by rwaldron

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to duplicate

comment:4 Changed 3 years ago by rwaldron

Duplicate of #7229.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.