Ticket #7358 (closed enhancement: wontfix)
Error object needs to be added to class2type map
| Reported by: | tomgrohl | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | core | Version: | 1.4.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
If you were to do anything like the following
try
{
alert(a);
}
catch(e)
{
alert( Object.prototype.toString.call(e) );
}
It would alert [object Error], but this is not in the jQuery class2type map;
I think Error needs adding, unless it is not in there for a reason.
New code is below:
jQuery.each("Boolean Number String Function Array Date RegExp Error Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
Change History
comment:2 Changed 3 years ago by snover
- Priority changed from undecided to low
- Status changed from new to open
- Component changed from unfiled to core
comment:4 Changed 2 years ago by kitgoncharov
While this is a useful, relatively minor addition, it's also implemented inconsistently in some WebKit-based browsers. Specifically, the Class? name of native Error objects is "Object," not "Error," in Safari 2.x. Since jQuery doesn't officially support Safari 2, this isn't a significant concern; however, the library does support some mobile browsers that are based on outdated WebKit versions. As such, the fact that we can't ensure complete cross-browser consistency for this change suggests that this ticket should be closed as "wontfix."
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This has already been proposed but it can't hurt to have a bug report to remember it. For further reference the original request for enhancement