#7218 closed bug (wontfix)
$('body').trigger('') causes error
Reported by: | 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 12 years ago by
Keywords: | body trigger added |
---|---|
Priority: | undecided → low |
Status: | new → open |
comment:2 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Resolution: | → wontfix |
Status: | open → closed |
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 12 years ago by
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 12 years ago by
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.
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.