Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#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:


If you were to do anything like the following


   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 jitter

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

comment:2 Changed 12 years ago by snover

Component: unfiledcore
Priority: undecidedlow
Status: newopen

comment:4 Changed 12 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."

comment:5 Changed 12 years ago by john

Milestone: 1.next
Resolution: wontfix
Status: openclosed

See my comments in the pull request, closing for now. Please reopen if we can prove that it's consistently working right.

Note: See TracTickets for help on using tickets.