Skip to main content

Bug Tracker

Side navigation

#11836 closed bug (worksforme)

Opened May 30, 2012 05:39AM UTC

Closed May 30, 2012 10:32AM UTC

jQuery.event.trigger throw error, if current element has empty attribute-event handler.

Reported by: dtyger@gmail.com Owned by:
Priority: low Milestone: None
Component: event Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Target: IE8 and below

If an element on event path has an empty attribute-event handler, say:

<input type="button" onfocus="" />

, jQuery.event.trigger stopped with error:

SCRIPT438: Object doesn't support property or method 'apply' 
jquery-1.7.1.js, line 3148 character 4

Source of problem:

line 3147: handle = ontype && cur[ ontype ];

in that situation cur!["onfocus"] returns empty Object, not Function.

Attachments (0)
Change History (1)

Changed May 30, 2012 10:32AM UTC by sindresorhus comment:1

component: unfiledevent
priority: undecidedlow
resolution: → worksforme
status: newclosed

Can't reproduce.

Tried this http://jsfiddle.net/mofle/WbHrY/ testcase in IE8 with jQ 1.7.1, 1.7.2 and edge.

Please post a jsfiddle testcase the next time, as described in the very visible red box.

Also, please DON'T use inline event handlers...