diff --git a/Userland/Libraries/LibWeb/Infra/CharacterTypes.h b/Userland/Libraries/LibWeb/Infra/CharacterTypes.h new file mode 100644 index 0000000000..e73ff470e9 --- /dev/null +++ b/Userland/Libraries/LibWeb/Infra/CharacterTypes.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, Linus Groh + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Web::Infra { + +// https://infra.spec.whatwg.org/#ascii-whitespace +constexpr bool is_ascii_whitespace(u32 code_point) +{ + // ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE. + return code_point == '\t' || code_point == '\n' || code_point == '\f' || code_point == '\r' || code_point == ' '; +} + +}