diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-11-10 08:47:01 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-11-10 17:02:11 +0000 |
commit | 941bc475381d979b5e06f3ea02300f75674b438f (patch) | |
tree | 36b00293b29daf9eea209d800709c104edff57ce /Userland/Libraries/LibWeb/HTML/AttributeNames.cpp | |
parent | 21c1494ac534279540c7b07e94f0284b280972a7 (diff) | |
download | serenity-941bc475381d979b5e06f3ea02300f75674b438f.zip |
LibWeb: Define method to check if an attribute is a boolean attribute
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/AttributeNames.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/AttributeNames.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp b/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp index d4425d2679..9bc32452bf 100644 --- a/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp +++ b/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp @@ -39,5 +39,38 @@ ENUMERATE_HTML_ATTRIBUTES } } + +// https://html.spec.whatwg.org/#boolean-attribute +bool is_boolean_attribute(FlyString const& attribute) +{ + // NOTE: This is the list of attributes from https://html.spec.whatwg.org/#attributes-3 + // with a Value column value of "Boolean attribute". + return attribute.is_one_of( + AttributeNames::allowfullscreen, + AttributeNames::async, + AttributeNames::autofocus, + AttributeNames::autoplay, + AttributeNames::checked, + AttributeNames::controls, + AttributeNames::default_, + AttributeNames::defer, + AttributeNames::disabled, + AttributeNames::formnovalidate, + AttributeNames::inert, + AttributeNames::ismap, + AttributeNames::itemscope, + AttributeNames::loop, + AttributeNames::multiple, + AttributeNames::muted, + AttributeNames::nomodule, + AttributeNames::novalidate, + AttributeNames::open, + AttributeNames::playsinline, + AttributeNames::readonly, + AttributeNames::required, + AttributeNames::reversed, + AttributeNames::selected); +} + } } |