Closed Bug 1056450 Opened 10 years ago Closed 8 years ago

Drop support for the two argument "flags" extension to String.prototype.match

Categories

(Core :: JavaScript Engine, defect)

31 Branch
x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1108382

People

(Reporter: 7cc, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.0; rv:31.0) Gecko/20100101 Firefox/31.0 (Beta/Release) Build ID: 20140716183446 Steps to reproduce: 1. run the following code. "ab".match(".", "gmi").length Actual results: It returns 2. Expected results: The return value should be 1. The second parameter should be ignored.
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
You're looking at the .length of the return value of the match call. The return value is ["a", "b"] in this case, which has a length of 2. If you wanted the .length of the function, then you want "ab".match.length, which indeed returns 1.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
(In reply to Boriz Zbarsky [:bz] from comment #1) > You're looking at the .length of the return value of the match call. The > return value is ["a", "b"] in this case, which has a length of 2. > > If you wanted the .length of the function, then you want "ab".match.length, > which indeed returns 1. No, I do want the length of the return value. In other words, the return value of "ab".match(".", "gmi") should be ["a"]. (I should have written that way.)
Oh, I see what you mean. Your issue is with match() treating the second argument as match flags. Thank you for explaining! Resummarizing to make that clearer.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Summary: The number of parameters of String.prototype.match is incorrect. → Drop support for the two argument "flags" extension to String.prototype.match
This non-standard features was removed in bug 1108382.
Status: REOPENED → RESOLVED
Closed: 10 years ago8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.