mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:57:35 +00:00
LibJS: Manually loop over escaped regex pattern instead of ::replace()
This makes it ever-so-slightly faster, but more importantly, it fixes the bug where a `/\//` regex's `source` property would return `\\/` ("\\\\/") instead of `\/` due to the existing '/' -> '\/' replace() call.
This commit is contained in:
parent
a8bcb901c0
commit
bcfbe0fbf7
2 changed files with 25 additions and 3 deletions
|
@ -3,6 +3,5 @@ test("basic functionality", () => {
|
|||
expect(RegExp().source).toBe("(?:)");
|
||||
expect(/test/.source).toBe("test");
|
||||
expect(/\n/.source).toBe("\\n");
|
||||
// FIXME: RegExp parse doesn't parse \/ :(
|
||||
// expect(/foo\/bar/.source).toBe("foo\\/bar");
|
||||
expect(/foo\/bar/.source).toBe("foo\\/bar");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue