Bug Tracker

Opened 11 years ago

Closed 11 years ago

#11836 closed bug (worksforme)

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

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: event Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


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.

Change History (1)

comment:1 Changed 11 years ago by sindresorhus

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...

Note: See TracTickets for help on using tickets.