Bug 71784 - RegExp.prototype.compile should return the regular expression, rather than undefined.
Summary: RegExp.prototype.compile should return the regular expression, rather than un...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 17822 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-08 01:50 PST by Erik Corry
Modified: 2012-03-11 15:25 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 Erik Corry 2011-11-08 01:50:32 PST
See http://code.google.com/p/v8/issues/detail?id=1815
Comment 1 Alexey Proskuryakov 2011-11-08 10:18:51 PST
Please post complete reports to Bugzilla. People reading bugs shouldn't need to click through to external sites.

The bug report says:

------------------------------
var expr = (new RegExp).compile('str');
// now expr will be undefined

The RegExp.prototype.compile function is non-standard.  Mozilla have tried to remove it at least once: https://bugzilla.mozilla.org/show_bug.cgi?id=630284

That said, FF will return the regexp, while Safari and Chrome will return undefined.
Comment 2 Gavin Barraclough 2012-03-11 15:22:05 PDT
*** Bug 17822 has been marked as a duplicate of this bug. ***
Comment 3 Gavin Barraclough 2012-03-11 15:25:02 PDT
Our behavior matches Opera and Chrome, I haven't tested IE.  Returning 'this' is not a common pattern in the JavaScript library, and doesn't seem appropriate here.  I don't think we want to change, unless there is a strong web-compatibility case to do so.