Skip to main content

Bug Tracker

Side navigation

#6163 closed bug (fixed)

Opened February 24, 2010 03:58PM UTC

Closed February 27, 2010 07:35AM UTC

Last modified March 14, 2012 02:15AM UTC

TypeError: events is null

Reported by: mike.helgeson Owned by: brandon
Priority: Milestone: 1.4.3
Component: event Version: 1.4.1
Keywords: Cc:
Blocked by: Blocking:
Description

When attempting to "handle" any events on an element that has no events bound to it, the handle function generates this exception. This is a simple fix. The handle function reads the "events" data for the element, then looks up the "handlers" for the given event type. In the case where events have never been bound, the "events" data is null and trying to read the handlers from null is creating the error.

The fix is on line 1919 of jQuery 1.4.2...

Change this:

handlers = events[ event.type ]

To this:

handlers = ( events || {} )[ event.type ]

The justification for this is any plugin that uses event publishing may cause event handling on elements where no events have been bound.

Sample page showing the error:

http://jsbin.com/oforu

Attachments (0)
Change History (3)

Changed February 27, 2010 07:27AM UTC by brandon comment:1

owner: → brandon

Changed February 27, 2010 07:27AM UTC by brandon comment:2

milestone: 1.4.21.4.3

Changed February 27, 2010 07:35AM UTC by brandon comment:3

resolution: → fixed
status: newclosed