Side navigation
#7358 closed enhancement (wontfix)
Opened October 30, 2010 02:06PM UTC
Closed April 12, 2011 07:14PM UTC
Last modified March 10, 2012 05:46AM UTC
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: | ||
Blocked by: | Blocking: |
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();
});
Attachments (0)
Change History (5)
Changed October 30, 2010 09:42PM UTC by comment:1
Changed October 31, 2010 12:42AM UTC by comment:2
component: | unfiled → core |
---|---|
priority: | undecided → low |
status: | new → open |
Changed April 06, 2011 04:25PM UTC by comment:3
Changed April 10, 2011 08:42PM UTC by comment:4
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."
Changed April 12, 2011 07:14PM UTC by comment:5
milestone: | → 1.next |
---|---|
resolution: | → wontfix |
status: | open → closed |
See my comments in the pull request, closing for now. Please reopen if we can prove that it's consistently working right.
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