Modify ↓
Ticket #6801 (closed bug: duplicate)
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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

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