Skip to main content

Bug Tracker

Side navigation

#7218 closed bug (wontfix)

Opened October 16, 2010 09:31PM UTC

Closed October 16, 2010 10:12PM UTC

Last modified November 12, 2010 10:17AM UTC

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

Reported by: owenocq@gmail.com 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

Attachments (0)
Change History (4)

Changed October 16, 2010 09:44PM UTC by addyosmani comment:1

_comment0: I can reproduce this in 1.4.3 as follows: [http://jsfiddle.net/addyosmani/JL2yX/2/ Live Test Case][[BR]] \ An error is output when using 1.4.3 (citing string replace issues) whilst 1.4.2 seems to function without any issues.1287267416881871
_comment1: I can reproduce this in 1.4.3 as follows: [http://jsfiddle.net/addyosmani/JL2yX/2/ Live Test Case][[BR]] \ 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 '' as a parameter in this case just wouldn't make sense.1287267456212998
keywords: → body trigger
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.

Changed October 16, 2010 10:12PM UTC by snover comment:2

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.

Changed October 17, 2010 01:23PM UTC by owenocq@gmail.com comment:3

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.

Changed November 12, 2010 10:17AM UTC by owenocq@gmail.com comment:4

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.