#6163 closed bug (fixed)
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:
Change History (3)
comment:1 Changed 13 years ago by
Owner: | set to brandon |
---|
comment:2 Changed 13 years ago by
Milestone: | 1.4.2 → 1.4.3 |
---|
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks! http://github.com/jquery/jquery/commit/7d5da0ee030b1962ff1ff57b0221a02dfdc2886a