Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#7218 closed bug (wontfix)

$('body').trigger('') causes error

Reported by: owenocq@… Owned by:
Priority: low Milestone: 1.4.4
Component: event Version: 1.4.3
Keywords: body trigger Cc:
Blocked by: Blocking:

Description

occurs for 1.4.3 but doesn't for 1.4.2

Change History (4)

comment:1 Changed 9 years ago by addyosmani

Keywords: body trigger added
Priority: undecidedlow
Status: newopen

I can reproduce this in 1.4.3 as follows: Live Test Case
An error is output when using 1.4.3 (citing string replace issues) whilst 1.4.2 seems to function without any issues. This may well be a coding issue as using the empty string parameter in this case just wouldn't make sense.

Last edited 9 years ago by addyosmani (previous) (diff)

comment:2 Changed 9 years ago by snover

Component: unfiledevent
Resolution: wontfix
Status: openclosed

Thanks for the report, but this is a coding error, not a jQuery bug. You can’t trigger a nothing-event on an object.

The error is raised because var type = event.type || event at the top of jQuery.event.trigger ends up selecting the event object when an empty event type is passed.

comment:3 Changed 9 years ago by owenocq@…

I think the error thrown should be more descriptive or not be thrown at all like in version 1.4.2

Major reason being it is difficult to track down the bug in a complex application. And on minor note - the majority of jQuery's functions (well all the ones that I use) don't error if passed unexpected variables, keeping the error in seems inconsistent.

comment:4 Changed 9 years ago by owenocq@…

A similar issue was fixed here http://bugs.jquery.com/ticket/7229

A bit inconsistent what gets fixed and what doesn't, and that other bug was already reporting a descriptive error message. Just saying is all.

Note: See TracTickets for help on using tickets.