From c88c33dc228be0fb865ae9b4a4c7d61d181629f7 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 30 Aug 2022 10:20:45 +0100 Subject: [PATCH] LibJS: Trim non-ASCII whitespace as well in StringToNumber This regressed in f4b3bb5. --- Userland/Libraries/LibJS/Runtime/Value.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index eddfe0b4bd..b0a7ea2d61 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -527,7 +527,7 @@ static Optional parse_number_text(StringView text) static Optional string_to_number(StringView string) { // 1. Let text be StringToCodePoints(str). - String text = string.trim_whitespace(); + String text = Utf8View(string).trim(whitespace_characters, AK::TrimMode::Both).as_string(); // 2. Let literal be ParseText(text, StringNumericLiteral). if (text.is_empty())