Bug 22082 - typeof should return "object" for RegExps instead of "function"
Summary: typeof should return "object" for RegExps instead of "function"
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 24716 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-11-05 06:53 PST by Maciej Stachowiak
Modified: 2011-10-04 10:03 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stachowiak 2008-11-05 06:53:48 PST
JavaScriptCore supports a longstanding Mozilla extension whereby RegExps are callable. Mozilla decided that despite this typeof should return "object" on RegExps, otherwise too much other code breaks or gets confused. This is also proposed as a change for ES3.1. Since Mozilla has already made this change, and since it would match the typeof return from IE and Opera, we should likely make this change.

In the future we could also consider removing the callable regexp extension, since it's not clear if it is needed for Web compatibility and so would let us remove a strange quirk.
Comment 1 Cameron Zwarich (cpst) 2009-03-20 08:18:07 PDT
*** Bug 24716 has been marked as a duplicate of this bug. ***
Comment 2 Gavin Barraclough 2011-10-03 13:49:21 PDT
This works for me in ToT
Comment 3 Alexey Proskuryakov 2011-10-04 10:03:40 PDT
Presumably fixed via bug 28285.