#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: | ||
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();
});
Change History (5)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → core |
---|---|
Priority: | undecided → low |
Status: | new → open |
comment:4 Changed 12 years ago by
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."
comment:5 Changed 12 years ago by
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