dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / css / property_name.lucb
#==============================================================================================
#
# property_name - is_a_valid_css_property
#
# DESCRIPTION:
# Port of LibWeb/CSS/PropertyName.h (lines 26-35). The header's other two functions,
# is_invalid_custom_property_name_string and is_a_custom_property_name_string, are
# css_data's (the generated property tables use them).
#
# Copyright (c) 2024-2025, Sam Atkins <sam@ladybird.org>
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
## Ported from Libraries/LibWeb/CSS/PropertyName.h:30 Web::CSS::is_a_valid_css_property.
# https://drafts.css-houdini.org/css-typed-om-1/#valid-css-property
pub func css_is_a_valid_css_property(string: ak.StringView) -> bool:
# A string is a valid CSS property if it is a custom property name string, or is a CSS property name recognized by
# the user agent.
return css_data.is_a_custom_property_name_string(string) or css_data.property_id_from_string(string) != none