Bug Tracker


Ticket #7358 (closed enhancement: wontfix)

Opened 3 years ago

Last modified 2 years ago

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:


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

comment:1 Changed 3 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 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 3 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 3 years ago by john

  • Status changed from open to closed
  • Resolution set to wontfix
  • Milestone set to 1.next

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.