mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibJS: Keep escaping forward slashes
Reverts 5dce916a50
.
Now:
> new RegExp('/').source
"\/"
This matches spec (and v8).
This commit is contained in:
parent
eb27b397b8
commit
3c8bfa4662
Notes:
sideshowbarker
2024-07-17 00:24:16 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/3c8bfa4662 Pull-request: https://github.com/SerenityOS/serenity/pull/17481 Reviewed-by: https://github.com/trflynn89 ✅
@ -249,7 +249,7 @@ DeprecatedString RegExpObject::escape_regexp_pattern() const
|
||||
if (m_pattern.is_empty())
|
||||
return "(?:)";
|
||||
// FIXME: Check the 'u' and 'v' flags and escape accordingly
|
||||
return m_pattern.replace("\n"sv, "\\n"sv, ReplaceMode::All).replace("\r"sv, "\\r"sv, ReplaceMode::All).replace(LINE_SEPARATOR_STRING, "\\u2028"sv, ReplaceMode::All).replace(PARAGRAPH_SEPARATOR_STRING, "\\u2029"sv, ReplaceMode::All);
|
||||
return m_pattern.replace("\n"sv, "\\n"sv, ReplaceMode::All).replace("\r"sv, "\\r"sv, ReplaceMode::All).replace(LINE_SEPARATOR_STRING, "\\u2028"sv, ReplaceMode::All).replace(PARAGRAPH_SEPARATOR_STRING, "\\u2029"sv, ReplaceMode::All).replace("/"sv, "\\/"sv, ReplaceMode::All);
|
||||
}
|
||||
|
||||
// 22.2.3.2.4 RegExpCreate ( P, F ), https://tc39.es/ecma262/#sec-regexpcreate
|
||||
|
Loading…
Reference in New Issue
Block a user